none
I get an error when open the xlsx file by excel Office 365 ProPlus created with Open XML library (ver 2.5) RRS feed

  • Question

  • Hello,

    as I described in the title, I'm not able to open the downloaded file by Excel Office 365.

    Here below the excel report log:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
       <logFileName>error084920_01.xml</logFileName>
       <summary>Errors were detected in file 'C:\Temps\Downloads\TestExcels\WorkOrderHistory20190910152818.xlsx'</summary>
       <additionalInfo>
          <info>Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.</info>
       </additionalInfo>
       <removedParts>
          <removedPart>Replaced Part: /xl/worksheets/sheet.xml part with XML error.  Load error. Line 1, column 0.</removedPart>
          <removedPart>Replaced Part: /xl/worksheets/sheet2.xml part with XML error.  Load error. Line 1, column 1167.</removedPart>
       </removedParts>
    </recoveryLog>

    By Productivity Tool, I found some errors (see below), but I don't understand where are located in the code.
    Error Node Type | Error Part                       | Error Node Path                                 | Related Node Type            | Description
    ==========+================+========================+=================+=======
    Font                 | /xl/styles.xml                  | /x:styleSheet[1]/x:fonts[1]/x:fonts[2] | OpenXmlUnknownElement | The element has invalid child element 'http://schemas.openxmlformats.org/spreadsheetml/2006/main:alignment'.
    Worksheet        | /xl/worksheets/sheet.xml | /x:worksheet[1]                                 | Columns                           | The element has unexpected child element 'http://schemas.openxmlformats.org/spreadsheetml/2006/main:cols'.
    Worksheet        | /xl/worksheets/sheet2.xml | /x:worksheet[1]                                 | Columns                           | The element has unexpected child element 'http://schemas.openxmlformats.org/spreadsheetml/2006/main:cols'.

    Someone could help me to identify the root cause of the error(s)?

    Thanks in advance.

    BR
    Andrea Z.

    Tuesday, September 10, 2019 2:36 PM

All replies

  • Finally I resolved my issue:
    I found this article on stackOverflow (found out by "Creating custom column widths in OpenXML (excel)") that explain very well the reason of my issue.

    So, what I understood, is that Excell is extremely picky.

    The custom columns must be put in the worksheet before the sheetdata, otherwise the resulted in a corrupted file.

    Thanks to Reid and Cindy Meister for their helpfull forum.

    I hope this resolution could help someone.

    BR

    Andrea Z.

    Wednesday, September 11, 2019 3:33 PM