0

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.

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Vihung
  • 12,947
  • 16
  • 64
  • 90

2 Answers2

1

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.

JasonPlutext
  • 15,352
  • 4
  • 44
  • 84
0

Maybe Templater?

Disclosure: I'm the author.

Rikard Pavelic
  • 476
  • 3
  • 5