https://github.com/plutext/docx4j/blob/ ... cture.docx is an example of a docx with a picture bound to XML.
If you unzip it and look at the document.xml part, you'll see:
Using xml Syntax Highlighting
<w:sdt>
<w:sdtPr>
<w:id w:val="1777441255"/>
<w:showingPlcHdr/>
<w:dataBinding w:prefixMappings="" w:xpath="/myxml[1]/element1[1]" w:storeItemID="{5448916C-134B-45E6-B8FE-88CC1FFC17C3}"/>
<w:picture/>
</w:sdtPr>
<w:sdtContent>
<w:p ..>
:
<w:drawing>
Parsed in 0.001 seconds, using
GeSHi 1.0.8.4
Notice the w:picture element, and the w:dataBinding
If you look at the XML part (/customXml/Item1.xml), you'll see the base64 encoded content:
Using xml Syntax Highlighting
<myxml>
<element1>iVBORw0KG
Parsed in 0.000 seconds, using
GeSHi 1.0.8.4
If you open it in Word, Word will display the picture (having first got it from the XML part).
docx4j can do the same thing. See the sample at
https://github.com/plutext/docx4j/blob/ ... dings.javaUsually, the XML you want to inject will be in a separate file outside the docx zip. For that, see
https://github.com/plutext/docx4j/blob/ ... geXML.javaHow do you set up the docx template in the first place? Use the Word AddIn; from
http://www.opendope.org/downloads/autho ... /setup.exeGo to the authoring tab, add your sample XML file, then drag/drop elements from the task pane onto the document surface.
Good luck .. feel free to post again in the data binding sub forum once you've had a bit of a play around...