Cell Style in Xls module

From Apache OpenOffice Wiki
Revision as of 02:32, 4 September 2012 by Bjcheny (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Cell Style decides how the cell will be presented to us. Its border, numbering, font style, font height, alignment, solid fill and so on.

cellStyles (Cell Styles)

<cellStyles count="4">

 <cellStyle name="20% - Accent1" xfId="3" builtinId="30"/> 
 <cellStyle name="Heading 1" xfId="2" builtinId="16"/> 
 <cellStyle name="Normal" xfId="0" builtinId="0"/> 
 <cellStyle name="Title" xfId="1" builtinId="15"/> 


CellStyles contains the named cell styles, consisting of a sequence of named style records. A named cell style is a collection of direct or themed formatting (e.g., cell border, cell fill, and font type/size/style) grouped together into a single named style, and can be applied to a cell.

CellStyle represents the name and related formatting records for a named cell style in this workbook. xfId (Format Id) Zero-based index referencing an xf record in the cellStyleXfs collection. This is used to determine the formatting defined for this named cell style.

cellStyleXfs (Formatting Records)

CellStyleXfs 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]

<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"/> 


cellXfs (Cell Formats)

CellXfs contains the master formatting records (xf) which define the formatting applied to cells in this workbook. These records are the starting point for determining the formatting for a cell. Cells in the Sheet Part reference the xf records by zero-based index.


A single xf element describes all of the formatting for a cell.

relationship between them

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.

That is: 1. Cell Style Xf - Explanatory 2. Cell Xf - bold

Currently, code is mainly located in stylesbuffer.cxx and stylesfragment.cxx under xls directory.

Personal tools