0
votes

I have a word document, let's call it a template though it is not a Word Template, which is made up of images, text, tables, headers, footers etc. some of which are populated by custom properties (Insert --> Fields --> DocProperty "fieldName").

Currently, my manual process involves copying a previous document, updating the values of the properties, and saving the new document.

I would like to replace this with an automated process, written in Java ideally as it will be invoked for a Java-based webpp.

Are there any Java libraries for processing the Word document whereby I can populate the custom properties in the document from a Java object model to generate a new document?

I imagine I could go deeper and actually try to process the zipped XML files in the .docx file, but something that just understand's Word's object model would be far better.

2

2 Answers

0
votes

See org/docx4j/samples/DocProps.java

Also, docx4j's FieldUpdater class can update the actual document using the values in the DocProp fields, so you don't have to open the docx in Word to do that.

0
votes

Maybe Templater?

Disclosure: I'm the author.