Question

Text formatting (font type, font size, colors, ...) gets lost when I try to bind an XML with a docx with content controls that contain text with formatting.

I have modified the sample ContentControlsMergeXML a little to illustrate the issue.

The binding method is called with FLAG_NONE to make sure that the controls are removed in the output document:

Code:

Docx4J.bind(wordMLPackage, xmlStream, Docx4J.FLAG_NONE);

I am using the latest docx4j-3.0.0.jar

Also see http://www.docx4java.org/forums/data-binding-java-f16/binding-loses-formatting-on-text-inside-content-controls-t1721.html for sample and detailed description

Was it helpful?

Solution

Fixed by https://github.com/plutext/docx4j/commit/d5cf4b697a9c99316233f2c37a8cdf725b7e691a

You can get the fix by building docx4j from source, or waiting for a 'nightly' build.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top