docx4j
docx4j copied to clipboard
applyBindings drops styling
I have document where data is loaded from customXml/item1.xml (inside docx). When I use BindingHandler to update document it will drop styling inside table rows (how it looks).
Here's the code I use to apply bindings:
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(docxFile);
OpenDoPEHandler odh = new OpenDoPEHandler(wordMLPackage);
wordMLPackage = odh.preprocess();
OpenDoPEIntegrity openDopeIntegrity = new OpenDoPEIntegrity();
openDopeIntegrity.process(wordMLPackage);
BindingHandler.getHyperlinkResolver().setHyperlinkStyle("Hyperlink");
BindingHandler bh = new BindingHandler(wordMLPackage);
bh.applyBindings();
OpenDoPEIntegrityAfterBinding odiab = new OpenDoPEIntegrityAfterBinding();
odiab.process(wordMLPackage);
wordMLPackage.save(docxFile);
And here is the docx file before and after applying bindings.