CellStyleFormats Class

Formatting Records.When the object is serialized out as xml, its qualified name is x:cellStyleXfs.

Namespace:  DocumentFormat.OpenXml.Spreadsheet
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

public class CellStyleFormats : OpenXmlCompositeElement

The following table lists the possible child types:

  • CellFormat <x:xf>

[ISO/IEC 29500-1 1st Edition]

18.8.9 cellStyleXfs (Formatting Records)

This element contains the master formatting records (xf's) which define the formatting for all named cell styles in this workbook. Master formatting records reference individual elements of formatting (e.g., number format, font definitions, cell fills, etc) by specifying a zero-based index into those collections. Master formatting records also specify whether to apply or ignore particular aspects of formatting. [Example: Whether to apply a border or not. end example]

A cell can have both direct formatting (e.g., bold) and a cell style (e.g., Explanatory) applied to it. Therefore, both the cell style xf records and cell xf records shall be read to understand the full set of formatting applied to a cell.

[Example:This example shows 4 master formatting records, each defining formatting for a named cell style (expressed in the cellStyles collection). Note that 0th record does not express any "apply" attributes, while the other records do express "apply" attribute values. For example, the last record specifies that number format, alignment, and protection formatting will not be applied to the cell, even when that information is specified in related formatting records.

<cellStyleXfs count="4">
<xf numFmtId="0" fontId="0" fillId="0" borderId="0"/>
  <xf numFmtId="0" fontId="2" fillId="0" borderId="0" applyNumberFormat="0"
applyFill="0" applyBorder="0" applyAlignment="0" applyProtection="0"/>
  <xf numFmtId="0" fontId="3" fillId="0" borderId="1" applyNumberFormat="0"
applyFill="0" applyAlignment="0" applyProtection="0"/>
  <xf numFmtId="0" fontId="4" fillId="2" borderId="2" applyNumberFormat="0"
applyAlignment="0" applyProtection="0"/>

end example]

Parent Elements

styleSheet (§18.8.39)

Child Elements


xf (Format)




count (Style Count)

Count of cell style (xf) elements.

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.

[Note: The W3C XML Schema definition of this element’s content model (CT_CellStyleXfs) is located in §A.2. end note]

© ISO/IEC29500: 2008.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.