Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xlsx file can't be opened in Office 365 after save #389

Closed
andreysubbotin opened this issue Mar 18, 2020 · 1 comment
Closed

xlsx file can't be opened in Office 365 after save #389

andreysubbotin opened this issue Mar 18, 2020 · 1 comment

Comments

@andreysubbotin
Copy link

andreysubbotin commented Mar 18, 2020

Test case:

  • Create an XLSX file using Office 365
  • Load -> save file.
        SpreadsheetMLPackage template =
                SpreadsheetMLPackage.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("template.xlsx"));
        RelationshipsPart rp = template.getRelationshipsPart();
        for (Relationship r : rp.getRelationships().getRelationship()) {
            Part part = rp.getPart(r);
            if (part instanceof JaxbXmlPart) {
                try {
                    ((JaxbXmlPart) part).getContents();
                } catch (Docx4JException e) {
                    throw new RuntimeException("Unable to get part contents", e);
                }
            }
        }

        Save saver = new Save(template);
        saver.save(new FileOutputStream("test_1.xlsx"));
  • Try to open saved file. File can't be opened in Office 365.
    Test project (run Main class and try to open generated test_1.xlsxin the project root)
    doc4j_test.zip
  • Error in logs:
[main] WARN org.docx4j.mce.ArrayListMce - com.sun.org.apache.xerces.internal.dom.ElementNSImpl does not implement Child
[main] WARN org.docx4j.jaxb.JaxbValidationEventHandler - [ERROR] : unexpected element (uri:"http://schemas.microsoft.com/office/spreadsheetml/2014/revision", local:"revisionPtr"). Expecte
[main] WARN org.docx4j.jaxb.JaxbValidationEventHandler - Column is 1242 at line number 2
[main] INFO org.docx4j.jaxb.JaxbValidationEventHandler - shouldContinue is set to false
[main] WARN org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware - unexpected element (uri:"http://schemas.microsoft.com/office/spreadsheetml/2014/revision", local:"revisionPtr"). Expected elements are <{http://schemas.openxmlformats.org/spreadsheetml/2006/main}oleSize>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}functionGroups>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}fileVersion>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}fileSharing>,<{http://schemas.openxmlformats.org/markup-compatibility/2006}AlternateContent>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}pivotCaches>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}definedNames>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}sheets>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}smartTagTypes>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}calcPr>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}customWorkbookViews>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}webPublishing>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}webPublishObjects>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}smartTagPr>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}workbookProtection>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}bookViews>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}extLst>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}workbookPr>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}fileRecoveryPr>,<{http://schemas.openxmlformats.org/spreadsheetml/2006/main}externalReferences>
[main] INFO org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware - encountered unexpected content in /xl/workbook.xml; pre-processing
[main] INFO org.docx4j.XmlUtils - Using org.docx4j.org.apache.xalan.transformer.TransformerImpl
[main] WARN org.docx4j.utils.XSLTUtils - Found some mc:AlternateContent
[main] WARN org.docx4j.utils.XSLTUtils - Missing mc:Fallback!  Dropping the mc:AlternateContent entirely.
[main] WARN org.docx4j.jaxb.JaxbValidationEventHandler - [ERROR] : unexpected element (uri:"http://schemas.microsoft.com/office/spreadsheetml/2014/revision", local:"revisionPtr"). Expecte
[main] WARN org.docx4j.jaxb.JaxbValidationEventHandler - troublesome node: <xr:revisionPtr xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" documentId="13_ncr:1_{90072CB2-1B60-4A41-A963-BAA5AC795DCA}" revIDLastSave="0" xr10:uidLastSave="{00000000-0000-0000-0000-000000000000}" xr6:coauthVersionLast="44" xr6:coauthVersionMax="44"/>
[main] WARN org.docx4j.jaxb.JaxbValidationEventHandler - in parent node: <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" mc:Ignorable="x15 xr xr6 xr10 xr2"><fileVersion appName="xl" lastEdited="7" lowestEdited="7" rupBuild="21929"/><workbookPr defaultThemeVersion="166925"/><xr:revisionPtr documentId="13_ncr:1_{90072CB2-1B60-4A41-A963-BAA5AC795DCA}" revIDLastSave="0" xr10:uidLastSave="{00000000-0000-0000-0000-000000000000}" xr6:coauthVersionLast="44" xr6:coauthVersionMax="44"/><bookViews><workbookView windowHeight="15840" windowWidth="29040" xWindow="-120" xr2:uid="{00000000-000D-0000-FFFF-FFFF00000000}" yWindow="-120"/></bookViews><sheets><sheet name="Sheet1" r:id="rId1" sheetId="1"/></sheets><definedNames><definedName name="NewEntity">Sheet1!$A$1:$B$2</definedName></definedNames><calcPr calcId="0"/></workbook>
[main] WARN org.docx4j.jaxb.JaxbValidationEventHandler - #document/workbook/revisionPtr
[main] INFO org.docx4j.jaxb.JaxbValidationEventHandler - continuing (with possible element/attribute loss)
[main] INFO org.docx4j.jaxb.NamespacePrefixMapperUtils - Using ri.NamespacePrefixMapper, which is suitable for the JAXB RI
[main] INFO org.docx4j.jaxb.NamespacePrefixMapperUtils - Using ri.NamespacePrefixMapperRelationshipsPart, which is suitable for the JAXB RI
[main] WARN org.docx4j.jaxb.NamespacePrefixMapperUtils - No mapping for prefix 'xr'
[main] WARN org.docx4j.jaxb.NamespacePrefixMapperUtils - No mapping for prefix 'xr6'
[main] WARN org.docx4j.jaxb.NamespacePrefixMapperUtils - No mapping for prefix 'xr10'
[main] WARN org.docx4j.jaxb.NamespacePrefixMapperUtils - No mapping for prefix 'xr2'
@plutext
Copy link
Owner

plutext commented Apr 7, 2020

docx4j 8.1.6 contains this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants