1
votes

I am generating a docx file with dynamic data in it using docx4j. The sample docx file is retrieved from database. Now i need to modify the dynamic data in the document.

I am using an xstream to generate the xml with dynamic data.

Could anyone tell me how to map this xml to the content controls used in doc files?

I have also found an xpath mapped to the already existing content controls. How is this xpath generated and how to modify the xpath so that i can add a new content control and map the dynamic data?

If any one could tell me how the doc with dynamic data is generated using docx4j, then that would be appreciated.

Thanks in advance.

1

1 Answers

1
votes

Disclosure: I manage the docx4j project, and wrote the OpenDoPE conventions

To "bind" a content control, you generally use a Word Add-In:

docx4j also supports repeats and conditionals, using the OpenDoPE convention. If you want to set up those sorts of content controls, you'll need to use an authoring Add-In which supports them, not one of the above. See further the OpenDoPE website and the docx4j data binding forum.

If you are using docx4j, I'd recommend you use the Add-In http://www.opendope.org/downloads/authoring-friendly/setup.exe

As to your question about how docx4j processes these files, see the docx4j Getting Started guide, and the various samples with name prefix 'ContentControls'