Hi @Chazg ,
You should take a look at ISO 29500-1:2016 where styles are defined for SpreadsheetML and workbook packages created by Excel. The standard can be downloaded here:
In section 18.8.7 cellStyle (Cell Style), you will find attributes on the cellStyle
tags used in the xl/styles.xml part. In particular xfId
is used to identify which formatting record is used by a given named style like "Normal". This xf
formatting record in the cellStylesXfs
block will contain a fontId
attribute that specifies the index into the fonts block of the correct font to be used.
For example, you will see something like this in xl/styles.xml:
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac x16r2 xr" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x16r2="http://schemas.microsoft.com/office/spreadsheetml/2015/02/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision">
<fonts count="2" x14ac:knownFonts="1">
<font>
<sz val="11"/>
<color theme="1"/>
<name val="Calibri"/>
<family val="2"/>
<scheme val="minor"/>
</font>
<font>
<sz val="11"/>
<color theme="1"/>
<name val="Envy Code R"/>
<family val="3"/>
</font>
</fonts>
<cellStyleXfs count="1">
<xf numFmtId="0" fontId="0" fillId="0" borderId="0"/>
</cellStyleXfs>
<cellXfs count="2">
<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>
<xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/>
</cellXfs>
<cellStyles count="1">
<cellStyle name="Normal" xfId="0" builtinId="0"/>
</cellStyles>
In this example, the first font (line 3 above) is index 0 in the font list and specifies Calibri.
Normal (line 25) specifies an xfId
of 0 which points to the first and only indexed xf
record in cellStyleXfs
(line 18). Normal is a built-in style which means it will be specified and have the attribute builtinId
set to 0
(which is for Normal). If the author of the workbook modifies the Normal style, it will have the customBuiltin
attribute set to 1
for true like this:
<cellStyle name="Normal" xfId="0" builtinId="0" customBuiltin="1"/>
I hope this helps, let me know if you have more questions.
Best regards,
Tom Jebo
Microsoft Open Specifications Support