Import named styles applied to columns
ods
In ods, we need to import named styles applied to the <table:table-column> element as the table:default-cell-style-name attribute. The Default style is typically applied to columns this way.
Example:
<table:table table:name="Sheet1" table:style-name="ta1">
<table:table-column table:style-name="co1" table:default-cell-style-name="Default"/>
<table:table-column table:style-name="co2" table:default-cell-style-name="Default"/>
<table:table-column table:style-name="co3" table:default-cell-style-name="My_20_Custom_20_Style"/>
...
xlsx
In xlsx, the <col> element in the worksheet part contains the style attribute that references the style applied. The specs are not clear on what the number means, but it appears to be a 0-based xfid for the xf record stored in the cellXfs block. This xf record in turn should include an xfId attribute which is an xfid into the cellStyleXfs block for named styles. There is a separate block called cellStyles which maps the style xfid to a name.
Example:
In sheet1.xml, the style attribute contains a 0-based index into cellXfs in styles.xml
<cols>
<col min="2" max="2" width="9.140625" style="1"/>
<col min="3" max="3" width="9.140625" style="2"/>
<col min="4" max="4" width="9.140625" style="3"/>
<col min="6" max="6" width="9.140625" style="4"/>
</cols>
In styles.xml, you first look into the cellXfs block to find the right xf, then read its xfId attribute to find the corresponding style definition in the cellStyleXfs block and the corresponding name in the cellStyles block:
<cellStyleXfs count="5">
<xf numFmtId="0" fontId="0" fillId="0" borderId="0"/>
<xf numFmtId="0" fontId="1" fillId="2" borderId="0" applyNumberFormat="0" applyBorder="0" applyAlignment="0" applyProtection="0"/>
<xf numFmtId="0" fontId="2" fillId="3" borderId="0" applyNumberFormat="0" applyBorder="0" applyAlignment="0" applyProtection="0"/>
<xf numFmtId="0" fontId="3" fillId="4" borderId="0" applyNumberFormat="0" applyBorder="0" applyAlignment="0" applyProtection="0"/>
<xf numFmtId="0" fontId="4" fillId="5" borderId="1" applyNumberFormat="0" applyFont="0" applyAlignment="0" applyProtection="0"/>
</cellStyleXfs>
<cellXfs count="5">
<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>
<xf numFmtId="0" fontId="2" fillId="3" borderId="0" xfId="2"/>
<xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="1"/>
<xf numFmtId="0" fontId="3" fillId="4" borderId="0" xfId="3"/>
<xf numFmtId="0" fontId="0" fillId="5" borderId="1" xfId="4" applyFont="1"/>
</cellXfs>
<cellStyles count="5">
<cellStyle name="Bad" xfId="2" builtinId="27"/>
<cellStyle name="Good" xfId="1" builtinId="26"/>
<cellStyle name="Neutral" xfId="3" builtinId="28"/>
<cellStyle name="Normal" xfId="0" builtinId="0"/>
<cellStyle name="Note" xfId="4" builtinId="10"/>
</cellStyles>
xls-xml
In xls-xml, just look into the Column element for its ss:StyleID attribute, which contains the ID into the corresponding style given earlier in the stream.
<Column ss:Index="2" ss:StyleID="s17"/>
<Column ss:StyleID="s16"/>
<Column ss:StyleID="s18"/>
<Column ss:Index="6" ss:StyleID="s23"/>