Page 1 of 1

Problem inserting xhtml in docx with docx4j 8.3

PostPosted: Fri Jul 09, 2021 8:09 pm
by bs_dellacqua
We are migrating our code from docx4j 8.2.9 to 8.3.0;
in our code we have to insert an xhtml table into a docx file; with docx4j version 8.2.9 we haven't problems, but with version 8.3.0 we have the error:
Exception in thread "main" java.lang.ClassCastException: java.math.BigInteger cannot be cast to org.docx4j.wml.CTSignedTwipsMeasure
at org.docx4j.model.properties.run.Spacing.set(Spacing.java:115)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.addRunProperties(XHTMLImporterImpl.java:2520)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.formatRPr(XHTMLImporterImpl.java:2243)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.addRun(XHTMLImporterImpl.java:2200)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.addRuns(XHTMLImporterImpl.java:2174)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.processInlineBoxContent(XHTMLImporterImpl.java:2099)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.processInlineBox(XHTMLImporterImpl.java:2052)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.traverseBlockBox(XHTMLImporterImpl.java:1393)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.traverse(XHTMLImporterImpl.java:915)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.traverseBlockBox(XHTMLImporterImpl.java:1377)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.traverse(XHTMLImporterImpl.java:915)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.traverseBlockBox(XHTMLImporterImpl.java:1377)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.traverse(XHTMLImporterImpl.java:915)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.traverse(XHTMLImporterImpl.java:906)
at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.convert(XHTMLImporterImpl.java:708)
at problem.Xhtml2docx.main(Xhtml2docx.java:68)

Our Java code is the same for both the version of docx4j and I've attached it with the used pom.xml.
What has changed in version 8.3.0 compared to 8.2.9?
In 8.3.0 I've seen there is the new file Spacing.java: what is its purpose ?

I've downloaded docx4j-ImportXHTML-master.zip, then I've modified the file pom.xml to use docx4j v8.3.0, and so executing the tests included in the zip file I have the same error.

Re: Problem inserting xhtml in docx with docx4j 8.3

PostPosted: Sat Jul 10, 2021 8:30 am
by jason
This will be fixed in 8.3.1 to be released on Monday.

Re: Problem inserting xhtml in docx with docx4j 8.3

PostPosted: Mon Jul 12, 2021 6:36 pm
by jason