Skip to content

API reference / Common / Engine types / GridCellFormat

Interface: GridCellFormat ​

A cell format — an xf (CT_Xf, §18.8.45) of styleSheet/cellXfs, which a cell's worksheet/sheetData/row/c/@s names, or of styleSheet/cellStyleXfs, a named style's. The paths below are given under styleSheet/cellXfs/xf.

It names one entry of each pool by id and carries its own alignment and protection. In Office this record alone decides how a cell looks — "only the cell xf record defines the formatting applied to a cell" (MS-OI29500 §2.1.699): style_format names the style the cell was formatted from, not a parent it inherits from.

Properties ​

PropertyDescription
numberFormat?
GridNumberFormatRef
styleSheet/cellXfs/xf/@numFmtId — one of Excel's built-in formats, or one of GridStyles::number_formats.
font?
string
styleSheet/cellXfs/xf/@fontId — one of GridStyles::fonts.
fill?
string
styleSheet/cellXfs/xf/@fillId — one of GridStyles::fills.
border?
string
styleSheet/cellXfs/xf/@borderId — one of GridStyles::borders.
styleFormat?
string
styleSheet/cellXfs/xf/@xfId — one of GridStyles::cell_style_formats: the named style this format was made from. A styleSheet/cellStyleXfs/xf carries none.
alignment?
GridCellAlignment
styleSheet/cellXfs/xf/alignment.
protection?
GridCellProtection
styleSheet/cellXfs/xf/protection.
apply
GridCellFormatApply
styleSheet/cellXfs/xf/@applyNumberFormat and the five other @apply… flags, as written.
quotePrefix
boolean
styleSheet/cellXfs/xf/@quotePrefix — the cell's text was typed with a leading ', which is not stored. false when absent, the schema's default.
pivotButton
boolean
styleSheet/cellXfs/xf/@pivotButton — the cell shows a PivotTable sort and filter button. false when absent, the schema's default.
extensionList?
ExtensionList
styleSheet/cellXfs/xf/extLst — the extensions the model has no field for.