开发者

Putting data in doc template using poi

I need to insert data in so开发者_运维百科me doc template and return it's changed value. I decided to use POI, but if there are other ways to solve my problems I may change the library. I can change the string using Range.replaceText(), but by this way I loose my text formatting, and the text itself turns into plain document with no styles and tables. Are there any ways to replace some characters saving the formatting? I tried RTFTemplate, but it could slightly help me, because it depends on Spring, but I use vaadin in my project.

Thanks in advance


Several years ago I was solving similar problem. The easiest way was to use RTF files as templates, and avoid using any parsing library, because MS Office RTF is not so standatd as you could expect, and any library that tries to "understand" this format tends to loose part of formatting.

So I just opened rtf files as plain text, and searched for my keywords within it. There was a problem when this keywords were splitted into several parts, divided by some non meaningful parts.

I will search my delphi sources and will try to port it to java later this week.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜