Page 1 of 1

Documents with decimal heigh values

PostPosted: Fri Sep 10, 2021 10:48 am
by petefc
Hello,

I am seeing issues with documents that have decimal values in the @val for various height and wiidth elements. For instance:
<w:trHeight w:val="460.95703125" w:hRule="atLeast"/>
<w:tblW w:w="9272.0" w:type="dxa"/>

the value of 460.95703125 causes a the following error:
Caused by: java.lang.NumberFormatException: For input string: ".95703125"
and cause the the JaxbXmlPart.getXml() method to return null.

the value of 9272.0 seems throws
java.lang.NumberFormatException: For input string: "9272.0"
but is the document xml is still returned.

I have a sense that this document may have been round-tripped through google docs and am trying to confirm.
attached is document with the content the causes the error.

Opening the document in word and saving corrects the issue.

Thanks.

Re: Documents with decimal heigh values

PostPosted: Sat Sep 11, 2021 11:54 am
by petefc
This issue is resolved by switching to the docx4j-JAXB-MOXy implementation.

Re: Documents with decimal heigh values

PostPosted: Sun Sep 26, 2021 6:07 pm
by jason
The w:tblW/@w:w triggers mc-preprocessor.xslt which fixes that issue, but it wasn't fixing the w:trHeight/@w:val issue.

Now fixed, at https://github.com/plutext/docx4j/commi ... ab1edcea37

If you need this before the next release, you can put it in a custom preprocessor: https://github.com/plutext/docx4j/blob/ ... rties#L192