We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Preserve Text and Formatting of Data Bound Content Control (SDT) during Converting DOCX using Java

since 19.6 when opening a document the content control text is replaced with the content from linked CustomXml.
If a document is opened and saved again without making further changes, you will get a different result.
If the document is opened with Word, the content control text is not replaced.

When replacing the content control texts, the formatting is lost. During the processing of documents, the content controls are replaced by text, but should keep the formatting.

test.zip (16.5 KB)

The document contains a StructuredDocumentTag and a CustomXmlPart with an entry, both are linked.
The text of the StructuredDocumentTag is “test”. The content of the CustomXmlPart entry is “customxml”.

If the document is opened with Word, “test” is still displayed.

Document doc = new Document(".\test.docx");

After the document has been opened and saved with Aspose, “customxml” is displayed.

Is it possible to restore the old behavior (texts are not replaced), for example by using an option?

Best regards


While using the latest version of Aspose.Words i.e. 20.4, we managed to reproduce this issue on our end. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-20331. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Hi @awais.hafeez,

thank you very much for the quick response.
Is there any workaround? Is there any way to switch off the automatic replacement of content from the CustomXml? Is it possible to determine the original formatting of the run element of the StructuredDocumentTag?
I’d appreciate any advice.

Best regards


We are currently doing the analysis of this issue to determine the root cause of the problem. I am afraid, there is no workaround available at the moment. We will inform you via this thread as soon as this issue will get resolved or any further update may be available. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-20331) have been fixed in this Aspose.Words for .NET 20.6 update and this Aspose.Words for Java 20.6 update.