I have a Word template, complete with fonts, colors, etc. I am querying a database and retrieving information into a POJO
. I want to extract the relevant info from said POJO
and create a Word document as per my template's directives.
The doc will have tables
and graphs
so I need to use Content Control Data Binding. As I understand it, I'll have to do the following to achieve this
- Modify the Word template to add content controls
- Transform the
POJO
into anXML
object (template?) - Use
ContentControlMergeXML
to bind the XML data to the Word template
Unfortunately, I can't find a good step-by-step example of this anywhere. Nearly all of the links in the docx4j
forum lead to broken GitHub
pages
My questions
- How can I use
OpenDoPE
to add tags to my Word template? I'll need to preserve style, so I want the correctOpenDoPE
version - Should the
POJO
be converted into an XML object or document? - Is there an end to end example of this entire process so I can follow along? (preferably with source code)