07.05.2014 Views

The Microsoft Excel File Format - OpenOffice.org

The Microsoft Excel File Format - OpenOffice.org

The Microsoft Excel File Format - OpenOffice.org

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.6 Cell <strong>Format</strong>ting<br />

4.6 Cell <strong>Format</strong>ting<br />

All cell formatting attributes are stored in XF records (➜5.115). <strong>The</strong> cell records themselves contain an index into the<br />

XF record list. This way of storing cell formatting saves memory and decreases the file size.<br />

4.6.1 Cell <strong>Format</strong>ting and Cell Styles<br />

<strong>The</strong> XF record is able to store explicit cell formatting attributes or the attributes of a cell style (BIFF3-BIFF8). Explicit<br />

formatting includes the reference to a cell style XF record. This allows to extend a defined cell style with some explicit<br />

attributes.<br />

<strong>The</strong> formatting attributes are divided into 6 groups:<br />

Group<br />

Number format<br />

Font<br />

Alignment<br />

Border<br />

Background<br />

Protection<br />

Attributes<br />

Number format index (index to FORMAT record)<br />

Font index (index to FONT record)<br />

Horizontal and vertical alignment, text wrap, indentation, orientation/rotation, text direction<br />

Border line styles and colours<br />

Background area style and colours<br />

Cell locked, formula hidden<br />

For each group a flag in the cell XF record specifies whether to use the attributes contained in that XF record or in the<br />

referenced style XF record. In style XF records, these flags specify whether the attributes will overwrite explicit cell<br />

formatting when the style is applied to a cell. Changing a cell style (without applying this style to a cell) will change all<br />

cells which already use that style and do not contain explicit cell attributes for the changed style attributes. If a cell XF<br />

record does not contain explicit attributes in a group (if the attribute group flag is not set), it repeats the attributes of its<br />

style XF record.<br />

4.6.2 Default <strong>Format</strong>ting<br />

Default formatting is applied to all cells which are not described by a cell record. In this case the default format of the<br />

row or column may be used (if defined). If an undefined cell contains a row and a column default format, the row format<br />

will overwrite the column format. If there are no row and column default formats available, the worksheet/workbook<br />

default cell format will be used.<br />

4<br />

5<br />

6<br />

7<br />

1<br />

2<br />

3<br />

row<br />

worksheet<br />

A B C D<br />

column<br />

Default column formatting is stored in the COLUMNDEFAULT record (BIFF2, ➜5.19) or in the COLINFO record<br />

(BIFF3-BIFF8, ➜5.18). <strong>The</strong> ROW record (➜5.88) contains the default format of a specific row. <strong>The</strong> default cell format<br />

is always present in an <strong>Excel</strong> file, described by the XF record with the fixed index 15 (0-based). By default, it uses the<br />

worksheet/workbook default cell style, described by the very first XF record (index 0).<br />

cell<br />

89

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!