I have a worksheet where one column "A" can have custom number format: 0"A" (number plus any text). Here's XML content of styles.xml file (some content was removed for brevity):
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <numFmts count="3"> <numFmt numFmtId="164" formatCode="0"А""/> <numFmt numFmtId="165" formatCode="0"N091716""/> <numFmt numFmtId="166" formatCode="0.0"/> </numFmts> <cellXfs count="21"> <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1"/> <xf numFmtId="1" fontId="4" fillId="0" borderId="4" xfId="0"> <alignment horizontal="right"/> </xf> <xf numFmtId="2" fontId="4" fillId="0" borderId="4" xfId="0"> <alignment horizontal="right"/> </xf> <xf numFmtId="164" fontId="4" fillId="0" borderId="4" xfId="0"> <alignment horizontal="right"/> </xf> <xf numFmtId="165" fontId="4" fillId="0" borderId="4" xfId="0"> <alignment horizontal="right"/> </xf> <xf numFmtId="166" fontId="4" fillId="0" borderId="4" xfId="0"> <alignment horizontal="right"/> </xf> </cellXfs> </styleSheet>
OOXML Specification ECMA-376 1-st Edition, Part 4: Markup Language Reference, §3.8.30 (page 2127, line 14).According to this paragraph, there's a list of formatCodes which are "implied rather than explicitly saved in the file". This means that we won't see these codes in numFmtId attribute of <xf> tags. Hence, all other remained number can be whatever.Unde "custom format" I mean the custom format IS NOT taken from built-in formats but rather is manually defined by user. In other words, it was hand-type in Format Cells -> Custom -> Type.Here's question: So, does it mean that all these hand-typed custom formats' numFmtIds always begin with 164?
I believe this is one of those situations where Excel is doing something in the version you are using, but there is no guarantee it will continue to do so. I doubt it matters what the ID is, but you can find out quickly by trying different IDs to see what happens. It is particularly easy to make simple modifications using the Open XML Package Editor Power Tool for Visual Studio and then open the resulting document in Excel to see if it works as expected.