How to insert data into a Microsoft Word Template using Java? [duplicate]

﹥>﹥吖頭↗ 提交于 2019-12-12 03:16:08

问题


I have a map of data that I want to insert into fields in an existing Microsoft Word Template. Preferably, I'd like to accomplish it using Java. I extracted text from a pdf file and then parsed it for data. Now, I need to figure out how to insert that data into a word template, which serves as a form. By data, I mean things such as name, address, etc.

Is it even possible? I haven't been able to locate any documentation or references that would help me with this task. I've been able to find some stuff on creating MS Word documents, but nothing as far as insertion into template text fields.


回答1:


I've used JWord several times to create documents from template. It's not free but accomplished what I needed.




回答2:


I suggest the ODFDOM project for ODF documents (LibreOffice, OpenOffice open document format, not Microsoft MOOXML format).

You can load an ODF document and modify variables inside it, style and content or you can create a document from scratch.

The project is quite active, the latest version available is 2014-06-02 - ODF Toolkit 0.6.1-incubating.



来源:https://stackoverflow.com/questions/17693553/how-to-insert-data-into-a-microsoft-word-template-using-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!