none
Understanding the style.xml file for excel OPEN xml RRS feed

  • Question

  • Hello guys im having a hard time understanding the relationship between the sheets and the styles xml. Here is my  Problem. I think this would be best explained if i use an example.

    I have sheet1.xml. for the sake of this question lets just stick to one sheet.

    The sheet contains this XML

    <sheetData>
        <row r="1" spans="1:13" ht="22.5" x14ac:dyDescent="0.45">
          <c r="A1" s="1" t="s">
            <v>0</v>
          </c>
          <c r="M1" s="3" t="s">
            <v>1</v>
          </c>
        </row>
        <row r="2" spans="1:13" x14ac:dyDescent="0.25">
          <c r="A2" s="2" t="s">
            <v>0</v>
          </c>
        </row>
      </sheetData>

    Now there is formatting on this sheet. If i take a look at Styles.XML i have the following.

    <fonts count="4" x14ac:knownFonts="1">
        
        <font>
          <sz val="11"/>
          <color theme="1"/>
          <name val="Calibri"/>
          <family val="2"/>
          <scheme val="minor"/>
        </font>
        
        <font>
          <b/>
          <sz val="14"/>
          <color theme="1"/>
          <name val="Arial Black"/>
          <family val="2"/>
        </font>
        
        <font>
          <u/>
          <sz val="11"/>
          <color theme="1"/>
          <name val="Calibri"/>
          <family val="2"/>
          <scheme val="minor"/>
        </font>
       
        <font>
          <i/>
          <sz val="11"/>
          <color theme="1"/>
          <name val="Cambria"/>
          <family val="1"/>
          <scheme val="major"/>
        </font>
     
      </fonts>
    
      
      <fills count="5">
        <fill>
          <patternFill patternType="none"/>
        </fill>
        <fill>
          <patternFill patternType="gray125"/>
        </fill>
        <fill>
          <patternFill patternType="solid">
            <fgColor rgb="FFFFFF00"/>
            <bgColor indexed="64"/>
          </patternFill>
        </fill>
        <fill>
          <patternFill patternType="solid">
            <fgColor rgb="FF92D050"/>
            <bgColor indexed="64"/>
          </patternFill>
        </fill>
        <fill>
          <patternFill patternType="solid">
            <fgColor rgb="FFFF0000"/>
            <bgColor indexed="64"/>
          </patternFill>
        </fill>
      </fills>
      <borders count="1">
        <border>
          <left/>
          <right/>
          <top/>
          <bottom/>
          <diagonal/>
        </border>
      </borders>
      <cellStyleXfs count="1">
        <xf numFmtId="0" fontId="0" fillId="0" borderId="0"/>
      </cellStyleXfs>
      <cellXfs count="4">
        <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>
        <xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1"/>
        <xf numFmtId="0" fontId="3" fillId="3" borderId="0" xfId="0" applyFont="1" applyFill="1"/>
        <xf numFmtId="0" fontId="2" fillId="4" borderId="0" xfId="0" applyFont="1" applyFill="1"/>
      </cellXfs>

    Now when i look the the documentation i cant get a clear picture what the relationship is. I though the concept would be the same as the shared string where if the cell holds a string you basically use the <v>##</v>  index value to get the true contents of the cell.

    Cell A1 its bold with font size 14 and yellow background color.

    Cell A2 its italic with a green background color.

    Cell M2 its underline with a red background color.

    I can see that the sheetdata has an attribut called "s" with a value of 1 which i believe is pointing to the styles sheet. However

    . what is the relationship between attribute s="1"

    in the sheet#.xml to the styles.ml. Right now I'm just guessing.

    Any help would be greatly appreciated.


    miguel

    Saturday, February 25, 2012 11:45 AM

Answers

  • Hi Miguel,

    You should be referring to the ISO 29500-1 sections 18.8.7 through 18.8.10.  These describe the 0 based index system for styles (and named styles as well).  This is what the s="1" refers to.  Specifically, the cellStyleXfs and cellXfs elements.  After reading these sections, let me know if you still aren't clear.

    I hope this helps,

    Best regards,
    Tom Jebo
    Escalation Engineer
    Microsoft Open Specifications

    Monday, February 27, 2012 8:59 PM
    Moderator

All replies

  • Hi miguel, thank you for your question. A member of the protocol documentation team will respond to you soon.

    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Saturday, February 25, 2012 10:01 PM
    Moderator
  • I would really appreciate that Jcurry. Up until now i keep looking over and over the documentation but its just not sinking in...Hope to hear from  you guys soon.

    Thanks

    Miguel


    miguel

    Sunday, February 26, 2012 4:34 PM
  • Hi Miguel,

    You should be referring to the ISO 29500-1 sections 18.8.7 through 18.8.10.  These describe the 0 based index system for styles (and named styles as well).  This is what the s="1" refers to.  Specifically, the cellStyleXfs and cellXfs elements.  After reading these sections, let me know if you still aren't clear.

    I hope this helps,

    Best regards,
    Tom Jebo
    Escalation Engineer
    Microsoft Open Specifications

    Monday, February 27, 2012 8:59 PM
    Moderator
  • Thank you for the response. I re-read Over it again. An i finally got it. I was missing the cellStyleXfs and cellXfs elements.

    Thanks

    Miguel


    miguel

    Tuesday, February 28, 2012 3:13 AM