Manually created Excel file displays error on opening on some systems

Home Forums SpreadsheetML Manually created Excel file displays error on opening on some systems

This topic contains 3 replies, has 2 voices, and was last updated by  Cronk 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4032

    Cronk
    Participant

    Hey all,
    I’m new to the manual-generation of OpenXML documents, specifically XLSX in this case. I’m trying to troubleshoot a problem in a system that someone else wrote…

    I have an Excel document that I’m having trouble with. It’s created manually, by scripts in a database system (FileMaker) that build the files as text objects one line at a time, then exports the text to a file; when it’s done it zips it up and tags it as an XLSX file. So this isn’t using a particular library…all of these scripts to build the file were hand written by someone else. Mostly, I’m saying this is done in C# or something that has predefined libraries for exporting this stuff.

    This Excel export process has been around for quite a while, and I believe it was working OK – at least, we hadn’t heard of any issues with it until recently. One person reported a problem opening the XLSX file that results from this scripted process. A 2nd person could open the file without any errors. I (a 3rd person now) got errors when opening the file, but was given the option to Repair it (Person1 was not given that option).

    The systems used to open the file:
    OS X 10.11.6, Excel for Mac 2011 (v14.4)
    Windows 10, Excel (v?? – couldn’t find a version; it has the ribbon and the large round logo in the top left corner, if that helps)
    OS X 10.10, Excel (v12.2.?)
    OS X 10.9, Excel (v12.2.? – different than the one above)

    The file in questions could be generated from multiple systems as well, using multiple and different data sets. I.e. it seemed that any version of the file exported was causing problems. Still could be something IN the data itself, but seems less likely.

    Anyway, when I opened one of these bad files on the Windows machine, it actually gave me a somewhat useful log report for the Repair process. But after digging through the specifics, I wasn’t able to find anything to obviously looked wrong.

    This export process uses a separate value sheet (ShareStrings.xml). The data set isn’t overly large – about 175 rows, 6 or 7 columns with data. It’s mostly being done in order to format some things in a particular way – some borders, font sizes, some headers, etc. There aren’t any forumals or scripts or anything – some merged fields is about as complicated as it gets.

    The “sheet1.xml” had this initial header:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">

    The useful error log XML is:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error070200_01.xml</logFileName>
    <summary>Errors were detected in file 'E:\...\ from aFile\File_damaged.xlsx'</summary>
    <additionalInfo>
        <info>Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.</info>
    </additionalInfo>
    <repairedParts summary="Following is a list of repairs:">
        <repairedPart>Repaired Part: /xl/styles.xml part with XML error.  (Styles) Load error. Line 253, column 63.</repairedPart>
    </repairedParts>
    <removedFeatures summary="Following is a list of removed features:">
        <removedFeature>Removed Feature: Format from /xl/styles.xml part (Styles)
        </removedFeature>
    </removedFeatures>
    <repairedRecords summary="Following is a list of repairs:">
        <repairedRecord>Repaired Records: Cell information from /xl/worksheets/sheet1.xml part</repairedRecord>
    </repairedRecords>
    </recoveryLog>

    When I go to the Styles.XML document, line 253 looks like this (column 63 is between the “p” and “T” of “wrapText”):
    <alignment horizontal="center" vertical="top" wrapText="1"/>

    When I looked up the “Repaired Records: Cell information…” error, folks talked about the value in the cell being a string instead of a number. Since it’s using a “SharedStrings.xml” file, it appears to be correct in it’s value definitions, which look like:
    <row r="17" spans="1:10" s="3" customFormat="1" ht="45" customHeight="1" x14ac:dyDescent="0.25"><c r="A17" s="16" t="s"><v>28</v></c><c r="B17" s="43" t="s"></c><c r="C17" s="44" t="s"></c><c r="D17" s="20" t="s"><v>29</v></c><c r="E17" s="45" t="s"></c><c r="F17" s="45" t="s"></c><c r="G17" s="45" t="s"></c><c r="H17" s="45" t="s"></c><c r="I17" s="46" t="s"><v>30</v></c><c r="J17" s="22" t="s"><v>31</v></c></row>

    I downloaded the MS OpenXML SDK (2.0) program, and tried to open the file there to validate it. But it wouldn’t open the file either, saying it was damaged.

    So…does anyone have hints on where to look next to figure out what’s causing the issue?

    Thanks,
    J

    #4033

    Cronk
    Participant

    EDIT: The Excel version on Windows is 2007.

    #4035

    Jim Snyder
    Participant

    If you still have a copy of the original before repairs, try opening that with OpenXML. Is it getting the same error there?

    #4036

    Cronk
    Participant

    Yes, that’s what I meant when I mentioned I opened the file in OpenXML – I was opening the original ‘bad’ file. OpenXML complained about the Zip data structures, though the error was related to Zip data – I think. Ah, something along the lines of:
    “cannot open file zip archive contains unsupported data structures”

    Hmmmm…interesting – I thought I had tried this already, but I just did it again: I manually unzipped and then rezipped the file and then tried to open that XLSX file (after renaming the extension). That DID open fine in MS OpenXML SDK Productivity Tools.

    The original (bad) file was created on OS X, and I did further testing with files that I created myself (but again on OS X). Oddly, one of my co-workers is able to open the same file on his OS X machine without any errors. I’ll try out a file created on Windows, though. (This system that I’m dealing with uses a plugin to zip up the final files; I’m not sure if the plugin uses it’s own binary for zipping, or the one installed on the current OS.

    I did some further testing on the OS X machine I have; I created an XLSX from the OS X side
    – Errored out in Excel (OSX)
    – Errored out in Excel (Windows)
    – Errored out in OpenXML SDK (Windows)

    I then extracted and recompressed the file on OS X, without changing the contents:
    – Errored out in Excel (OSX)
    – Errored out in Excel (Windows)
    – Opened OK in OpenXML SDK

    And then I created the same XLSX file on the Windows machine:
    – Opened OK in Excel (OSX)
    – Opened OK in Excel (Windows)
    – Opened OK in OpenXML SDK

    So…maybe it’s just a Zip error.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.