How to insert data into a Microsoft Word Template

2019-08-28 00:51发布

This question already has an answer here:

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.

2条回答
Fickle 薄情
2楼-- · 2019-08-28 01:38

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.

查看更多
【Aperson】
3楼-- · 2019-08-28 01:52

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

查看更多
登录 后发表回答