i'm new with docx4j and i had a look at some samples and played a little bit with it. My goal is to substitute fields in an effictive and for the user simple way. The user should be able create his word documents and i replace some data in this field and create pdf-Files out of it. Docx4J seems to be the perfect solution for it.
I tried the ContentControlsApplyBindings and it worked fine. I created a docx-File by the sample source, changed some content in den word-document and the xml-File (invoice-data.xml)... then i tried to create my own docx-File and fill it with data, like in the sample. But it doesn't work... and i don't understand why.
How did i create the input-docx File:
- First i created a docx-File with Word 2013
- Then i opened the developer mode and inserted an "only text content control field"
- After that i added the xml-File (invoice-data.xml) as XML mapping
- At the end i bind an element of the invoice-data.xml to my content control field.
Exception in thread "main" org.docx4j.openpackaging.exceptions.Docx4JException: Couldn't find CustomXmlDataStoragePart! exiting..
at org.docx4j.Docx4J.bind(Docx4J.java:299)
at org.docx4j.Docx4J.bind(Docx4J.java:275)
at org.docx4j.samples.ContentControlBindingExtensions.main(ContentControlBindingExtensions.java:99)
What's wrong? What did i miss? The sample ContentControlsMergeXML also doesn't work in my workspace... thank you very much in advance for your support.
Environment:
- Java 7
- Windows 7 64bit
- Winword 2013
- docx4J 3.0.2-SNAPShot