I am analyzing an OpenXML Excel file. I check the styles.xml, I find many entries like this:
<xf numFmtId="0" [..]>
However, there are no <numFmt> element in the styles.xml file at all. In such a case, how can I determine the number format for that style?
If the user applies a custom number format then the styles.xml file will contain numFmt elements like this with a numFmtId and formatCode:
<numFmts count="1">
<numFmt
numFmtId="165"
formatCode="0.000"/>
</numFmts>
The numFmtId is then used in the <xf> element to reference the number format.
However, if the user applies a standard or built-in format such as 0.00 then a numFmt element isn't written. The <xf> element still contains a numFmtId but it refers to a built-in format that isn't stored in the file.
Number format ids less than 164 (but most often in the range 0-50) represent builtin formats.
Here is a list of some of the built-in formats form the XlsxWriter documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With