Page 1 of 1

Unable to process a document with 0.5" margins

PostPosted: Fri Oct 28, 2022 11:28 pm
by besterht
Caused by: javax.xml.bind.JAXBException: For input string: "215.99999"

Attached the document we use as a template for variable replacement.

Code: Select all
WordprocessingMLPackage wordMLPackage;
            try {
                wordMLPackage = WordprocessingMLPackage.load(template);
                MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
               
                Document wmlDocumentEl = documentPart.getJaxbElement();  // failing on this line with several NumberFormatExceptions
                Body body = wmlDocumentEl.getBody();                                    // wmlDocumentEl is null
               


Will adding the margins to docx4j.properties work or should I handle it with custom-preprocessor.xslt?

Thanks!

Re: Unable to process a document with 0.5" margins

PostPosted: Sat Oct 29, 2022 11:04 am
by jason
I can't see any problem with the docx you attached; please check.

But typically, an issue of the type you describe is caused by saving the docx in some non-compliant application (eg Google Docs), and yes, fixed in a preprocessor xslt. If it is caused by a non-compliant application in common use, we would look to add the fix to the built-in mc-preprocessor.xslt

Re: Unable to process a document with 0.5" margins

PostPosted: Mon Oct 31, 2022 5:03 pm
by besterht
Thanks Jason, Yes we're using Google Docs