File opens on Excel Mac but corrupt on Excel Windows drawing1.xml related

Issue #658 resolved
David S. Brown
created an issue

The file generated by openpyxl (2.3.3 & 2.3.5) creates a file that Mac OS X 10.10.5 that opens correctly on Mac Excel 2011 14.6.6. However opened on various Windows PCs it reports a corrupted file.

The problem is related to Bar Charts not Radar Charts or cells.

Here is the corruption log:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error111600_01.xml</logFileName><summary>Errors were detected in file 'https://d.bl3301.docs.live.net/4388919585cbaded/Documents/Prog/..edited.... APR2015_original.xlsx'</summary><removedParts summary="Following is a list of removed parts:"><removedPart>Removed Part: /xl/drawings/drawing1.xml part.  (Drawing shape)</removedPart></removedParts></recoveryLog>

The enclosed files have an original unmodified file and a file opened on Mac and then resaved. The original is corrupt on Windows, the saved one opens on Windows.

Code is available if necessary.

Comments (14)

  1. Charlie Clark

    Thanks for the report. The reports from Excel usually aren't very helpful and further analysis indicates the problem is with the charts, which are stored as separate files… The OOXML validator suggests that the problem is with the values assigned to the style and axis units. It looks like the defaults for these are being overwritten. Can you please supply the code you use to create the charts?!

    Bildschirmfoto 2016-07-29 um 11.23.35.png

  2. Charlie Clark

    Can you say what you're trying to achieve by setting the style and axis unit to 0? Adding a constraint for the style is easy but the access can be any positive or negative float apart from 0 and I'm a bit loathe to write descriptor just for this.

  3. David S. Brown reporter

    Probably because I am unfamiliar with the interface, I have been using the source code to try to understand the more advanced aspects of charts. I have used chart1.style = 0 from the beginning without problem and never gave it another thought.I am not sure what you mean by setting the Axis to zero. I will upload what is probably the offending function.

  4. Charlie Clark

    Well, the charts interface is almost 1:1 the specification. It's been simplified where possible but it's the only sane way to deal with this. There's too much to document sensibly so you're best thumbing your own way through the 5000 page spec yourself! ;-) § 21 is the relevant part for charts.

  5. Charlie Clark

    Please think about adding to the docs for this kind of thing. I've added a constraint for the style but I really don't want to have to do that for axisUnit

    <xsd:simpleType name="ST_AxisUnit">
        <xsd:restriction base="xsd:double">
           <xsd:minExclusive value="0"/>
        </xsd:restriction>
    </xsd:simpleType>
    
  6. Charlie Clark

    BTW. you might find it easier to create your own chart styles for this kind of thing. Or use templates (once I get round to implementing read functionality for charts).

  7. Log in to comment