Page 1 of 1

Excel file issue with watermark.

PostPosted: Mon Oct 12, 2020 2:13 pm
by Johanna
Hi Jason,

I am using docx4j vesion 8.2.0 to remove metadata (creator, LastModifiedBy). (I am using the class SpreadsheetMLPackage to load file and the class SaveToZipFile to save the new file)
I have a file with a watermark that get corrupt after removed metadata.
I tried with the latest version 8.2.3 also the file get corrupted.
The new thing in those files are the watermark, so wonder if this versions support the watermark for exel files?

Can I get some advice how to fix it?

note: Attached file to get corrupt after remove metadata.

Thanks in advance
Regard,
Johanna

Re: Excel file issue with watermark.

PostPosted: Tue Oct 13, 2020 11:05 am
by jason
Please attach code I can use to reproduce?

Re: Excel file issue with watermark.

PostPosted: Wed Oct 14, 2020 10:34 am
by Johanna
Hi Jason, Find attach the code.

Cheers,
Johanna

Re: Excel file issue with watermark.

PostPosted: Mon Oct 26, 2020 9:46 am
by jason
Hi Johanna

Running your code, the output opens for me in a recent Excel (16.0.13231.20372).

When you say the "file gets corrupted", can Excel open it for you?

Or is it that the "Working doc" watermark is missing? (I can see that).

Or some other problem? Perhaps a screenshot might help.

cheers .. Jason

Re: Excel file issue with watermark.

PostPosted: Tue Oct 27, 2020 7:05 pm
by Johanna
Hi Jason, find attach the screenshot when I am trying to open the file using office 365 and libreOffice.

Cheers,
Johanna

Re: Excel file issue with watermark.

PostPosted: Thu Oct 29, 2020 8:21 am
by jason
Hi Johanna

I was able to open the output file in Excel online. Could you please double check that your sample code does reproduce the problem, when you run it on a working input document? It may reduce confusion if your code gives the output xlsx a different name. Please attach the output xlsx.

Regarding LibreOffice, I see similar (I'm using 6.4.5.2). Is there a difference between the input xlsx and the output xlsx when you open both in LibreOffice?

cheers .. Jason

Re: Excel file issue with watermark.

PostPosted: Wed Nov 04, 2020 2:02 pm
by Johanna
Hi Jason,
I updated the code to set different name to the output file. I also added the logger. I still unable to open the output files :? . I am using:
- Microsoft office 365 ProPlus, version (16.0.12527.21230) 32 bit.
- Java 8
- Last release docx4j 8.2.3
Please find attached the code, the samples files and output sample files and the logs.


the logs:
12:52:10.222 [main] INFO org.docx4j.utils.XPathFactoryUtil 38 - xpath implementation: org.docx4j.org.apache.xpath.jaxp.XPathFactoryImpl
12:52:10.230 [main] INFO org.xlsx4j.jaxb.Context 46 - java.vendor=Private Build
12:52:10.230 [main] INFO org.xlsx4j.jaxb.Context 47 - java.version=1.8.0_252
12:52:10.697 [main] INFO org.xlsx4j.jaxb.Context 69 - MOXy JAXB implementation is in use!
12:52:10.846 [main] INFO o.d.jaxb.NamespacePrefixMapperUtils 46 - Using MOXy NamespacePrefixMapper
12:52:10.855 [main] INFO o.d.jaxb.NamespacePrefixMapperUtils 109 - Using MOXy NamespacePrefixMapper
12:52:10.889 [main] WARN org.docx4j.mce.ArrayListMce 65 - com.sun.org.apache.xerces.internal.dom.ElementNSImpl does not implement Child
12:52:10.891 [main] WARN o.d.jaxb.JaxbValidationEventHandler 89 - [ERROR] : unexpected element (uri:"http://schemas.microsoft.com/office/spreadsheetml/2014/revision", local:"revisionPtr"). Expecte
12:52:10.891 [main] WARN o.d.jaxb.JaxbValidationEventHandler 104 - Column is 1307 at line number 2
12:52:10.891 [main] INFO o.d.jaxb.JaxbValidationEventHandler 188 - shouldContinue is set to false
12:52:10.892 [main] WARN o.d.o.parts.JaxbXmlPartXPathAware 499 -
Exception Description: An error occurred unmarshalling the document
Internal Exception: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 1307; unexpected element (uri:"http://schemas.microsoft.com/office/spreadsheetml/2014/revision", local:"revisionPtr"). Expected elements are <{http://schemas.openxmlformats.org/spreadsheetml/2006/main}fileVersion>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}fileSharing>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}workbookPr>,<{http://schemas.openxmlformats.org/markup-compatibility/2006}AlternateContent>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}workbookProtection>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}bookViews>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}sheets>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}functionGroups>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}externalReferences>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}definedNames>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}calcPr>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}oleSize>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}customWorkbookViews>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}pivotCaches>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}smartTagPr>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}smartTagTypes>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}webPublishing>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}fileRecoveryPr>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}webPublishObjects>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}extLst>
12:52:10.896 [main] DEBUG org.docx4j.utils.ResourceUtils 47 - docx4j.jaxb.JaxbValidationEventHandler resolved to org/docx4j/jaxb/mc-preprocessor.xslt
12:52:10.896 [main] DEBUG org.docx4j.utils.ResourceUtils 70 - Attempting to load: org/docx4j/jaxb/mc-preprocessor.xslt
12:52:11.066 [main] WARN org.docx4j.utils.XSLTUtils 17 - Found some mc:AlternateContent
12:52:11.067 [main] WARN org.docx4j.utils.XSLTUtils 17 - Missing mc:Fallback! Dropping the mc:AlternateContent entirely.
12:52:11.964 [main] WARN o.d.openpackaging.io.SaveToZipFile 351 - Encountered external resource https://consulting.global.deloitteonlin ... .0_LO.xlsx of type http://schemas.openxmlformats.org/offic ... alLinkPath
Document saved as: /home/jchacon/Documents/JARMedatataOct2020/MetadataCleanOriginal/sample04-11Original/sample01-output.xlsx

Thanks for your help,

Regards,
Johanna

Re: Excel file issue with watermark.

PostPosted: Wed Nov 11, 2020 10:29 am
by jason
Hi Johanna

Progress at last!

Turns out there is a problem when using MOXy (as you are), as opposed to the JAXB Reference Implementation. See https://stackoverflow.com/questions/647 ... ere-xsdany

I have a workaround; this will be in a new docx4j release later in the week.

kind regards .. Jason

Re: Excel file issue with watermark.

PostPosted: Thu Nov 12, 2020 10:01 am
by Johanna
Hi Jason,
Thanks so much,
I will be waiting for the new release to test.

Cheers,
Johanna

Re: Excel file issue with watermark.

PostPosted: Fri Nov 13, 2020 3:43 pm
by jason
Hi Johanna, the fix is in 8.2.4, just released.
Out of curiousity, what was your driver for choosing to use the MOXy JAXB implementation? (There is nothing wrong with this choice, I'm just interested in how/why people come to adopt one or the other of the JAXB implementations)
cheers .. Jason