Page 1 of 1

Docx4j 11.2.9 released - following Word updates

PostPosted: Mon Apr 19, 2021 10:44 am
by jason
docx4j 11.2.9 is now in Maven Central.

This is a JPMS modularised release for Java 11 (or later) users. Java 11 users can use docx4j 8.2.9 if they wish; Java 8 users should use docx4j 8.2.9.

The driver for this release is to ensure the namespace corresponding to the w16sdtdh is declared when docx4j manipulates a docx containing that prefix (which will be the case for documents edited in Word following recent updates). ... dtdatahash is new in [MS-DOCX] v15.0. Word (following recent updates) writes this namespace prefix to @mc:Ignorable in the MDP, for example, "w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14". Since Word is unable to open a document if a prefix which appears in that attribute is not declared, the namespace must be declared.

Thanks to those who raised this issue.

To use docx4j 11.2.9 via Maven, just add one and only one of docx4j-JAXB-Internal, docx4j-JAXB-MOXy,
or docx4j-JAXB-ReferenceImpl to your pom.

Otherwise, see

Re: Docx4j 11.2.9 released - following Word updates

PostPosted: Thu Apr 22, 2021 11:38 pm
by Lightenix
Hi, thanks for this update jason, it solved our problem...

PS: I would appreciate if it would be possible to make this library a bit more bulletproof for word updates ;)

Best regards

Re: Docx4j 11.2.9 released - following Word updates

PostPosted: Fri Jul 30, 2021 11:12 am
by petefc
Hi Jason,

Thanks for the update. This resolve issues with the the removal of w16sdtdh namespace in the document and comment parts, however the w16sdtdh namespace is still being removed in all of the footer parts.

The footer xml does now get the
attribute mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14"
but the namespace is missing.

This project where this is running explicitly imports

and then imports
implementation('org.docx4j:docx4j-ImportXHTML:8.2.1') {
exclude module: 'docx4j-samples-resources'
exclude group: 'org.docx4j', module: 'docx4j-core'

I tried importing just org.docx4j:docx4j-ImportXHTML:8.2.1 and allowing docx4j-core:8.3.1 to be pulled in transitively and in this case i get the w16sdtdh in the footer.xml but NOT in the document.xml

Any thoughts would be most appreciated.



Re: Docx4j 11.2.9 released - following Word updates

PostPosted: Sat Jul 31, 2021 2:38 am
by petefc
Hi Jason,

We have resolved this issue on our end. It turns out that the issue was introduced the source document when we opened it with docx-core 8.2.8 and added a custom property. Some parts had the w16sdtdh namespaces stripped out when it was saved.

Is this an issue that will crop up if an additional namespaces is added in the future ?