Hello all,
I was wondering if anyone has found a workaround for this issue with nested lists. I see there's a bug filed on github here: https://github.com/plutext/docx4j/issues/175
Thanks for any assistance!
It is currently Thu Nov 28, 2024 6:49 pm
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:case xmlns:ns2="http://gctrack.gao.gov/templates/case-data">
<documentId>118905</documentId>
<fileNumber>408694</fileNumber>
<caseNumber>9</caseNumber>
// xmlDocument is created by JAXB marshalling of my data class to Document
//created using docx4j org.docx4j.XmlUtils#neww3cDomDocument
wordMLPackage = Docx4J.load(new File(targetPath, "case-data-elements-inventory.docx"));
Docx4J.bind(wordMLPackage, xmlDocument, Docx4J.FLAG_BIND_INSERT_XML +
Docx4J.FLAG_BIND_BIND_XML + Docx4J.FLAG_BIND_REMOVE_SDT);
<xpath id="EtFsy">
<dataBinding xpath="string-length(/Template[1]/SLD[1]/BusinessSystems[1]/BusinessSystem[1]/Products[1]/Product[1]/Vendor[1])>0" storeItemID="{B981C26E-07CC-4E04-8DB5-6381C1213442}"/>
</xpath>
Can not convert #BOOLEAN to a NodeList!
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
CTCustomXmlBlock ctCustomXmlBlock=new CTCustomXmlBlock();
CTCustomXmlPr ctCustomXmlPr=new CTCustomXmlPr();
ctCustomXmlBlock.getContent().add(ctCustomXmlPr);
ctCustomXmlBlock.setElement("customizedElement");
CTAttr ctAttr=new CTAttr();
ctAttr.setName("testAttrName");
ctAttr.setVal("testValue");
ctAttr.setParent(ctCustomXmlPr);
ctCustomXmlPr.getAttr().add(ctAttr);
P p=new P();
R r=new R();
Text t=new Text();
t.setValue("marked text here");
r.getContent().add(t);
p.getContent().add(r);
ctCustomXmlBlock.getContent().add(p);
wordMLPackage.getMainDocumentPart().getContent().add(ctCustomXmlBlock);
wordMLPackage.save(new java.io.File(System.getProperty("user.dir") + "/OUT_withCustomXml.docx") );
Total posts 10111 • Total topics 2842 • Total members 2074