none
cellStyleXfs node is missing in styles.xml RRS feed

  • Question

  • Hi All,

    I received a xlsx file and found there is no cellStyleXfs node in the styles.xml, which cause exception when handling the file by APACHE POI api.

    Could someone provide probable reasons for the missing of cellStyleXfs?

    Thanks

    <?xml version="1.0" encoding="UTF-8"?>
    <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
    <numFmts>
    <numFmt numFmtId="0" formatCode="General"/>
    <numFmt numFmtId="1" formatCode="#0"/>
    <numFmt numFmtId="2" formatCode="M/d/yy h:mm a"/>
    </numFmts>
    <fonts>
    <font><sz val="11"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font>
    <font><sz val="9"/><color rgb="000000"/><name val="SansSerif"/><b val="false"/><i val="false"/><u val="single"/><strike val="false"/><family val="2"/></font>
    <font><sz val="9"/><color rgb="000000"/><name val="SansSerif"/><b val="false"/><i val="false"/><u val="none"/><strike val="false"/><family val="2"/></font>
    </fonts>
    <fills>
    <fill><patternFill patternType="none"/></fill>
    <fill><patternFill patternType="solid"><fgColor rgb="FFFFFF"/></patternFill></fill>
    <fill><patternFill patternType="none"/></fill>
    <fill><patternFill patternType="solid"><fgColor rgb="FF0000"/></patternFill></fill>
    <fill><patternFill patternType="none"/></fill>
    <fill><patternFill patternType="none"/></fill>
    <fill><patternFill patternType="none"/></fill>
    <fill><patternFill patternType="none"/></fill>
    <fill><patternFill patternType="solid"><fgColor rgb="FFFF33"/></patternFill></fill>
    <fill><patternFill patternType="solid"><fgColor rgb="339900"/></patternFill></fill>
    <fill><patternFill patternType="solid"><fgColor rgb="FFFFFF"/></patternFill></fill>
    </fills>
    <borders>
    <border><left/><right/><top/><bottom/><diagonal/></border>
    </borders>
    <cellXfs>
    <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1" applyProtection="1" applyNumberFormat="1" applyFont="1" applyFill="1" applyBorder="1"/>
    <xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="1" applyAlignment="1" applyProtection="1" applyNumberFormat="1" applyFont="1" applyFill="1" applyBorder="1"><alignment wrapText="true" horizontal="left" vertical="top"/><protection hidden="false" locked="true"/></xf>
    <xf numFmtId="0" fontId="0" fillId="3" borderId="0" xfId="2" applyAlignment="1" applyProtection="1" applyNumberFormat="1" applyFont="1" applyFill="1" applyBorder="1"><alignment wrapText="true"/><protection hidden="false" locked="false"/></xf>
    <xf numFmtId="0" fontId="2" fillId="4" borderId="0" xfId="3" applyAlignment="1" applyProtection="1" applyNumberFormat="1" applyFont="1" applyFill="1" applyBorder="1"><alignment wrapText="true" horizontal="left" vertical="top"/><protection hidden="false" locked="true"/></xf>
    <xf numFmtId="0" fontId="2" fillId="5" borderId="0" xfId="4" applyAlignment="1" applyProtection="1" applyNumberFormat="1" applyFont="1" applyFill="1" applyBorder="1"><alignment wrapText="true" horizontal="right" vertical="top"/><protection hidden="false" locked="true"/></xf>
    <xf numFmtId="1" fontId="2" fillId="6" borderId="0" xfId="5" applyAlignment="1" applyProtection="1" applyNumberFormat="1" applyFont="1" applyFill="1" applyBorder="1"><alignment wrapText="true" horizontal="left" vertical="top"/><protection hidden="false" locked="true"/></xf>
    <xf numFmtId="2" fontId="2" fillId="7" borderId="0" xfId="6" applyAlignment="1" applyProtection="1" applyNumberFormat="1" applyFont="1" applyFill="1" applyBorder="1"><alignment wrapText="true" horizontal="left" vertical="top"/><protection hidden="false" locked="true"/></xf>
    <xf numFmtId="0" fontId="0" fillId="8" borderId="0" xfId="7" applyAlignment="1" applyProtection="1" applyNumberFormat="1" applyFont="1" applyFill="1" applyBorder="1"><alignment wrapText="true"/><protection hidden="false" locked="false"/></xf>
    <xf numFmtId="0" fontId="0" fillId="9" borderId="0" xfId="8" applyAlignment="1" applyProtection="1" applyNumberFormat="1" applyFont="1" applyFill="1" applyBorder="1"><alignment wrapText="true"/><protection hidden="false" locked="false"/></xf>
    <xf numFmtId="0" fontId="0" fillId="10" borderId="0" xfId="9" applyAlignment="1" applyProtection="1" applyNumberFormat="1" applyFont="1" applyFill="1" applyBorder="1"><alignment wrapText="true"/><protection hidden="false" locked="false"/></xf>
    </cellXfs>
    <dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleLight16"/>
    </styleSheet>
    

    Wednesday, May 20, 2015 4:22 AM

All replies

  • Hello pupifan

    Thank you for contacting Microsoft Support. A support engineer will be in touch to assist further.

    Regards.


    Tarun Chopra | Escalation Engineer | Open Specifications Support Team

    Wednesday, May 20, 2015 4:58 PM
  • Hello pupifan,

    I will be working with you on this issue. I'm currently researching your question and will get back to you if I need additional information.

    Thanks,
    Kamil Sykora

    Wednesday, May 20, 2015 6:45 PM
  • thx Sykora
    Thursday, May 21, 2015 2:31 AM
  • Hello pupifan,

    The specification (ISO/IEC 29500-1) states the following schema for this element:

    <xsd:complexType name="CT_Stylesheet">
       <xsd:sequence>
          <xsd:element name="numFmts" type="CT_NumFmts" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="fonts" type="CT_Fonts" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="fills" type="CT_Fills" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="borders" type="CT_Borders" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="cellStyleXfs" type="CT_CellStyleXfs" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="cellXfs" type="CT_CellXfs" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="cellStyles" type="CT_CellStyles" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="dxfs" type="CT_Dxfs" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="tableStyles" type="CT_TableStyles" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="colors" type="CT_Colors" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="extLst" type="CT_ExtensionList" minOccurs="0" maxOccurs="1"/>
       </xsd:sequence>
    </xsd:complexType>

    Please note the minOccurs="0" for cellStyleXfs which indicates that this element is not required. The application should handle a non-existent cellStyleXfs element.

    I've looked through the specification and the implementation notes [MS-OI29500] and it does not state explicitly what the lack of this element means. However, based on my reading of the specification, specifically this statement:

    "This element contains the master formatting records (xf's) which define the formatting for all named cell styles in this workbook."

    I would interpret the lack of this element as meaning that there are no named cell styles present.

    Please let me know if that helps.

    Thanks,
    Kamil Sykora

    Friday, May 22, 2015 6:01 PM
  • Hello pupifan,

    Please let me know if you have any additional questions related to this issue.

    Thanks,
    Kamil Sykora

    Wednesday, June 3, 2015 7:59 PM