Microsoft Excel File Format

Microsoft Office Technical Documentation Group

Created: November, 1995

Click to open or copy the BIFFVIEW project files

Click to open or copy the DUMPBIFF project files

The binary interchange file format (BIFF) is the file format in which Microsoft Excel workbooks are saved on disk. Microsoft Excel versions 5.0 and later use compound files; this is the OLE 2 implementation of the Structured Storage Model standard. For more information on this technology, see the OLE 2 Programmer's Reference, Volume One, and Inside OLE 2, both published by Microsoft Press® and available from your local bookstore.

File Format Versions: BIFF5 and BIFF7

The BIFF7 file format of Microsoft Excel version 7.0 is nearly identical to the BIFF5 file format of Microsoft Excel version 5.0. There are some new records in BIFF7 and some records that have changed from BIFF5. This article documents both the BIFF5 and BIFF7 file formats.

The following tables describe the new records and changed records in BIFF7. For more information on the new and changed records, see the appropriate record description, later in this article.

New Records in BIFF7

Number

Record

1A5h

FILESHARING2

13Dh

TABID

EAh

TABIDCONF


Changed Records in BIFF7

Number

Record

Changes

9Eh

AUTOFILTER

The BIFF7 record includes several new fields to support the Top 10 AutoFilter feature.

5Bh

FILESHARING

The BIFF7 and BIFF5 records are identical, but the behavior of the record changes in BIFF7 when the workbook contains a shared list.


There are also several new streams in the BIFF7 file. The User Names and Revision Log streams support the new shared list feature in Microsoft Excel 7.0. The binary format of these streams is not documented.

The DocumentSummaryInformation (new to BIFF7) and SummaryInformation streams support the document properties available in Microsoft Excel 7.0, which are standardized across the Office 95 family of applications.

The Workbook Compound File

An OLE 2 compound file is essentially "a file system within a file." The compound file contains a hierarchical system of storages and streams. A storage is analogous to a directory, and a stream is analogous to a file in a directory. Each Microsoft Excel workbook is stored in a compound file, an example of which is shown in the following illustration. This file is a workbook that contains three sheets: a worksheet with a PivotTable, a Visual Basic module, and a chart.

If a workbook contains embedded objects, then the file will also contain storages written by the applications that created the objects. The PivotTable data cache storage and VBA PROJECT storage are not documented. The CompObj stream contains OLE 2 component object data, and the Summary Info stream contains the standardized file summary information such as title, subject, author, and so on.

The Book stream begins with a BOF record, and then contains workbook global records up to the first EOF. The workbook global section contains one BOUNDSHEET record for each sheet in the workbook. You can use the dt field (document type), the lbPlyPos field (stream position of the BOF record for the sheet), and the cch/rgch fields (sheet name as a byte-counted string) to quickly read selected sheets in the workbook.

Each sheet in the workbook is stored after the workbook global section, beginning with BOF and ending with EOF. If you read the file in a continuous stream (instead of using the BOUNDSHEET records), you can test the dt field of each BOF record to determine the sheet type.

Simple Save (New for BIFF7)

Microsoft Excel 7.0, uses a new simple save method from OLE 2, which was developed to increase performance. If a workbook contains no Visual Basic modules, no PivotTables, and no embedded objects on worksheets, then Microsoft Excel uses the simple save method.

When Microsoft Excel 7.0 saves a workbook using simple save, the streams in the file must be at least 4kbytes long. The OLE 2 code adds padding bytes to the streams to ensure that they are at least 4kbytes long. If you use a low-level binary viewer to examine the resulting file, you will see the padding bytes appearing as "garbage" at the end of the streams.

To find the actual end of the Book stream, you can increment a counter every time you read a BOF record and then decrement it every time you read an EOF record. When the counter reaches zero, then you have read the last EOF in the Book stream and you can ignore the rest of the bytes in that stream.

Other Microsoft Excel File Formats

Although chart records are written as part of the Book stream, they are documented in another article. Microsoft Excel creates several other files, some of which are documented. The workspace file is documented in a separate article. The toolbar file (.XLB extension in Microsoft Windows) is not documented.

This article contains BIFF documentation for Microsoft Excel versions 5.0 and 7.0 only. Earlier versions of BIFF documentation are available on the Development Library (published by the Microsoft Developer Network). The Library is a CD-based reference source for Windows-based developers. For more information about this service, contact Microsoft Developer Network via email (devnetwk@microsoft.com), via Compuserve (>INTERNET:devnetwk@microsoft.com), or call (800) 759-5474.

BIFF Record Information

Although different BIFF record types contain different information, every record has the same basic format. All BIFF records consist of the following three sections:

Record Number

This 16-bit word identifies the record. The hexadecimal value of the record number is included in parentheses in the heading of the record description. For example, the EOF record's heading appears in this article as "EOF: End of File (0Ah)."

Record Data Length

This 16-bit word equals the length of the following record data, in bytes. The record length depends on the type of data in the record. For example, the EOF record is always the same length, while a FORMULA record varies in length depending on the length of the formula itself.

Record Data

This is the portion of the record containing the actual data that describes the formula, window, object, and so on.

The format for all BIFF records is described in the following table.

Offset

Length (bytes)

Contents

0

2

Record number

2

2

Record data length

4

Variable

Record data


A BIFF record has a length limit of 2084 bytes, including the record type and record length fields. Therefore, the record data field must be no longer than 2080 bytes. A large data object has a parent record and then one or more CONTINUE records to store the data. For example, embedded bitmap graphic objects often use a parent IMDATA record and several CONTINUE records.

If a field (or a bit in a field) is marked "Reserved," then your application should treat the field or bit as a "don't-care" when you read or write the BIFF file. If a field (or bit in a field) is marked "Reserved; must be zero," then you must write zeros to the field or bit when you write a BIFF file.

Byte Swapping

Microsoft Excel BIFF files are transportable across the MS-DOS/Windows (Intel® 80x86), and Apple Macintosh (Motorola® 680x0) operating systems, among others. To support transportability, Microsoft Excel writes BIFF files in the 80x86 format, where the low-order byte of the word appears first in the file, followed by the high-order byte. For example, the BOF record consists of six 16-bit words:


0809 0008 0500 0005 096C 07C9

and it appears in a BIFF file as:


09 08 08 00 00 05 05 00 6C 09 C9 07

Whenever Microsoft Excel for the Macintosh reads or writes a BIFF file, it calls a function that swaps the high- and low-order bytes of every 16-bit word in every record in the file. For 32-bit longs, the bytes in each 16-bit word are swapped first, and then the two 16-bit words are swapped. Be sure to include a byte-swap function in any custom BIFF utility you write for the Macintosh.

BIFF Versions

You can determine the BIFF version (and infer the Microsoft Excel version that wrote the file) by testing the high-order byte of the record number of the BOF record. For example, the first BOF record in a BIFF5/BIFF7 workbook file is:

09 08 08 00 00 05 05 00 6C 09 C9 07 (08h in high-order byte)

while the BOF record in a BIFF4 chart file is:

09 04 06 00 00 00 20 00 00 00 (04h in high-order byte)

In BIFF4 and earlier, some records (other than the BOF record) contained version information in the high-order byte of their record numbers. This proved to be redundant, so for BIFF5 and later, Microsoft Excel determines the BIFF version by reading the high-order byte of the record number of the BOF record.

Beginning with this version of the Microsoft Excel Developer's Kit, record numbers are documented as full 16-bit numbers instead of 8-bit numbers with a high-order version number byte. For example, the DIMENSIONS record is now documented as record number 200h instead of 00h. This causes the records to appear in a different order in the following table, "BIFF Records: Record Number Order."

Indexing in BIFF Records

In BIFF files, rows and columns are always stored zero-based, rather than with an offset of one as they appear in a sheet. For example, cell A1 is stored as row 0 (rw = 00h), column 0 (col = 00h); cell B3 is row 2 (rw = 02h), column 1 (col = 01h), and so on.

In most cases, you can use the variable-naming conventions in this article to determine if a variable is zero-based. Variable names that begin with the letter i are usually indexes, which are zero-based. For example, the variable ixfe occurs in every cell record; it is a zero-based index into the table of XF records. Variable names that begin with the letter c are usually counts, which are one-based. For example, many records contain a cch, which is a count of characters in the following string.

Undefined Cells in the Sheet

To reduce file size, cells that don't contain values or formulas and aren't referenced by formulas in any other cell are considered to be undefined cells. Such undefined cells don't appear in the BIFF file.

For example, if a worksheet has a value in cell A3, and the formula =A3+A4 in cell B10, then the only defined cells on the worksheet are A3, A4, and B10. No other cells need to exist.

Using this technique, entire rows can be undefined if they have no defined cells in them. In the preceding example, only rows 3, 4, and 10 are defined, so the file contains only three ROW records.

Cell Records

The term "cell records" refers to the BIFF record types that actually contain cell data. Cell records that appear in BIFF5/BIFF7 files are shown in the following table.

Record

Contents

ARRAY

An array-entered formula

BLANK

An empty cell

BOOLERR

A Boolean or error value

FORMULA

A cell formula, stored as parse tokens

LABEL

A string constant

NUMBER

An IEEE floating-point number

MULBLANK

Multiple empty cells (new to BIFF5)

MULRK

Multiple RK numbers (new to BIFF5)

RK

An RK number

RSTRING

Cell with character formatting

SHRFMLA

A shared formula (new to BIFF5)

STRING

A string that represents the result of a formula


Microsoft Excel stores cell records in blocks that have at most 32 rows. Each row that contains cell records has a corresponding ROW record in the block, and each block contains a DBCELL record at the end of the block. For more information about row blocks and about optimizing your code when searching for cell records, see Finding Cell Records in BIFF Files.

BIFF Record Order

BIFF record order has changed as the file format has evolved. The simplest way to determine BIFF record order is to create a workbook in Microsoft Excel and then use the BiffView utility to examine the record order.

BIFF Utilities

There are two BIFF utilities in the Microsoft Solutions Development Kit. Use the BiffView utility (BIFFVIEW.EXE, a Windows program) to examine BIFF5/BIFF7 workbook files. Use DUMPBIFF.EXE (an MS-DOS program) to examine the BIFF5/BIFF7 workspace file.

BIFF Records: Alphabetical Order

Number

Record

22

1904: 1904 Date System

87

ADDIN: Workbook Is an Add-in Macro

C2

ADDMENU: Menu Addition

221

ARRAY: Array-Entered Formula

9E

AUTOFILTER: AutoFilter Data

9D

AUTOFILTERINFO: Drop-Down Arrow Count

40

BACKUP: Save Backup Version of the File

201

BLANK: Cell Value, Blank Cell

809

BOF: Beginning of File

DA

BOOKBOOL: Workbook Option Flag

205

BOOLERR: Cell Value, Boolean or Error

29

BOTTOMMARGIN: Bottom Margin Measurement

85

BOUNDSHEET: Sheet Information

0C

CALCCOUNT: Iteration Count

0D

CALCMODE: Calculation Mode

42

CODEPAGE: Default Code Page

7D

COLINFO: Column Formatting Information

3C

CONTINUE: Continues Long Records

A9

COORDLIST: Polygon Object Vertex Coordinates

8C

COUNTRY: Default Country/Region and WIN.INI Country/Region

5A

CRN: Nonresident Operands

D7

DBCELL: Stream Offsets

50

DCON: Data Consolidation Information

52

DCONNAME: Data Consolidation Named References

51

DCONREF: Data Consolidation References

225

DEFAULTROWHEIGHT: Default Row Height

55

DEFCOLWIDTH: Default Width for Columns

C3

DELMENU: Menu Deletion

10

DELTA: Iteration Increment

200

DIMENSIONS: Cell Table Size

B8

DOCROUTE: Routing Slip Information

88

EDG: Edition Globals

0A

EOF: End of File

16

EXTERNCOUNT: Number of External References

223

EXTERNNAME: Externally Referenced Name

17

EXTERNSHEET: External Reference

2F

FILEPASS: File Is Password-Protected

5B

FILESHARING: File-Sharing Information

1A5h

FILESHARING2: File-Sharing Info for Shared Lists (BIFF7)

9B

FILTERMODE: Sheet Contains Filtered List

9C

FNGROUPCOUNT: Built-in Function Group Count

9A

FNGROUPNAME: Function Group Name

231

FONT: Font Description

15

FOOTER: Print Footer on Each Page

41E

FORMAT: Number Format

406

FORMULA: Cell Formula

AB

GCW: Global Column Width Flags

82

GRIDSET: State Change of Gridlines Option

80

GUTS: Size of Row and Column Gutters

83

HCENTER: Center Between Horizontal Margins

14

HEADER: Print Header on Each Page

8D

HIDEOBJ: Object Display Options

1B

HORIZONTALPAGEBREAKS: Explicit Row Page Breaks

7F

IMDATA: Image Data

20B

INDEX: Index Record

E2

INTERFACEEND: End of User Interface Records

E1

INTERFACEHDR: Beginning of User Interface Records

11

ITERATION: Iteration Mode

204

LABEL: Cell Value, String Constant

26

LEFTMARGIN: Left Margin Measurement

95

LHNGRAPH: Named Graph Information

94

LHRECORD: .WK? File Conversion Information

98

LPR: Sheet Was Printed Using LINE.PRINT( )

C1

MMS: ADDMENU/DELMENU Record Group Count

BE

MULBLANK: Multiple Blank Cells

BD

MULRK: Multiple RK Cells

218

NAME: Defined Name

1C

NOTE: Note Associated with a Cell

203

NUMBER: Cell Value, Floating-Point Number

5D

OBJ: Describes a Graphic Object

63

OBJPROTECT: Objects Are Protected

D3

OBPROJ: Visual Basic Project

DE

OLESIZE: Size of OLE Object

92

PALETTE: Color Palette Definition

41

PANE: Number of Panes and Their Position

13

PASSWORD: Protection Password

4D

PLS: Environment-Specific Print Record

0E

PRECISION: Precision

2B

PRINTGRIDLINES: Print Gridlines Flag

2A

PRINTHEADERS: Print Row/Column Labels

12

PROTECT: Protection Flag

89

PUB: Publisher

B9

RECIPNAME: Recipient Name

0F

REFMODE: Reference Mode

27

RIGHTMARGIN: Right Margin Measurement

27E

RK: Cell Value, RK Number

208

ROW: Describes a Row

D6

RSTRING: Cell with Character Formatting

5F

SAVERECALC: Recalculate Before Save

AF

SCENARIO: Scenario Data

AE

SCENMAN: Scenario Output Data

DD

SCENPROTECT: Scenario Protection

A0

SCL: Window Zoom Magnification

1D

SELECTION: Current Selection

A1

SETUP: Page Setup

BC

SHRFMLA: Shared Formula

90

SORT: Sorting Options

96

SOUND: Sound Note

99

STANDARDWIDTH: Standard Column Width

207

STRING: String Value of a Formula

293

STYLE: Style Information

91

SUB: Subscriber

C5

SXDI: Data Item

DC

SXEXT: External Source Information

D5

SXIDSTM: Stream ID

B4

SXIVD: Row/Column Field IDs

B5

SXLI: Line Item Array

B6

SXPI: Page Item

CD

SXSTRING: String

D0

SXTBL: Multiple Consolidation Source Info

D2

SXTBPG: Page Item Indexes

D1

SXTBRGIITM: Page Item Name Count

B1

SXVD: View Fields

B2

SXVI: View Item

B0

SXVIEW: View Definition

E3

SXVS: View Source

13Dh

TABID: Sheet Tab Index Array (BIFF7)

EAh

TABIDCONF: Sheet Tab ID of Conflict History (BIFF7)

236

TABLE: Data Table

60

TEMPLATE: Workbook Is a Template

28

TOPMARGIN: Top Margin Measurement

DF

UDDESC: Description String for Chart Autoformat

5E

UNCALCED: Recalculation Status

84

VCENTER: Center Between Vertical Margins

1A

VERTICALPAGEBREAKS: Explicit Column Page Breaks

3D

WINDOW1: Window Information

23E

WINDOW2: Sheet Window Information

19

WINDOWPROTECT: Windows Are Protected

5C

WRITEACCESS: Write Access User Name

86

WRITEPROT: Workbook Is Write-Protected

81

WSBOOL: Additional Workspace Information

59

XCT: CRN Record Count

E0

XF: Extended Format


BIFF Records: Record Number Order

Number

Record

0A

EOF: End of File

0C

CALCCOUNT: Iteration Count

0D

CALCMODE: Calculation Mode

0E

PRECISION: Precision

0F

REFMODE: Reference Mode

10

DELTA: Iteration Increment

11

ITERATION: Iteration Mode

12

PROTECT: Protection Flag

13

PASSWORD: Protection Password

13Dh

TABID: Sheet Tab Index Array (BIFF7)

14

HEADER: Print Header on Each Page

15

FOOTER: Print Footer on Each Page

16

EXTERNCOUNT: Number of External References

17

EXTERNSHEET: External Reference

19

WINDOWPROTECT: Windows Are Protected

1A

VERTICALPAGEBREAKS: Explicit Column Page Breaks

1A5h

FILESHARING2: File-Sharing Info for Shared Lists (BIFF7)

1B

HORIZONTALPAGEBREAKS: Explicit Row Page Breaks

1C

NOTE: Note Associated with a Cell

1D

SELECTION: Current Selection

200

DIMENSIONS: Cell Table Size

201

BLANK: Cell Value, Blank Cell

203

NUMBER: Cell Value, Floating-Point Number

204

LABEL: Cell Value, String Constant

205

BOOLERR: Cell Value, Boolean or Error

207

STRING: String Value of a Formula

208

ROW: Describes a Row

20B

INDEX: Index Record

218

NAME: Defined Name

22

1904: 1904 Date System

221

ARRAY: Array-Entered Formula

223

EXTERNNAME: Externally Referenced Name

225

DEFAULTROWHEIGHT: Default Row Height

231

FONT: Font Description

236

TABLE: Data Table

23E

WINDOW2: Sheet Window Information

26

LEFTMARGIN: Left Margin Measurement

27

RIGHTMARGIN: Right Margin Measurement

27E

RK: Cell Value, RK Number

28

TOPMARGIN: Top Margin Measurement

29

BOTTOMMARGIN: Bottom Margin Measurement

293

STYLE: Style Information

2A

PRINTHEADERS: Print Row/Column Labels

2B

PRINTGRIDLINES: Print Gridlines Flag

2F

FILEPASS: File Is Password-Protected

3C

CONTINUE: Continues Long Records

3D

WINDOW1: Window Information

40

BACKUP: Save Backup Version of the File

406

FORMULA: Cell Formula

41

PANE: Number of Panes and Their Position

41E

FORMAT: Number Format

42

CODEPAGE: Default Code Page

4D

PLS: Environment-Specific Print Record

50

DCON: Data Consolidation Information

51

DCONREF: Data Consolidation References

52

DCONNAME: Data Consolidation Named References

55

DEFCOLWIDTH: Default Width for Columns

59

XCT: CRN Record Count

5A

CRN: Nonresident Operands

5B

FILESHARING: File-Sharing Information

5C

WRITEACCESS: Write Access User Name

5D

OBJ: Describes a Graphic Object

5E

UNCALCED: Recalculation Status

5F

SAVERECALC: Recalculate Before Save

60

TEMPLATE: Workbook Is a Template

63

OBJPROTECT: Objects Are Protected

7D

COLINFO: Column Formatting Information

7F

IMDATA: Image Data

80

GUTS: Size of Row and Column Gutters

809

BOF: Beginning of File

81

WSBOOL: Additional Workspace Information

82

GRIDSET: State Change of Gridlines Option

83

HCENTER: Center Between Horizontal Margins

84

VCENTER: Center Between Vertical Margins

85

BOUNDSHEET: Sheet Information

86

WRITEPROT: Workbook Is Write-Protected

87

ADDIN: Workbook Is an Add-in Macro

88

EDG: Edition Globals

89

PUB: Publisher

8C

COUNTRY: Default Country/Region and WIN.INI Country/Region

8D

HIDEOBJ: Object Display Options

90

SORT: Sorting Options

91

SUB: Subscriber

92

PALETTE: Color Palette Definition

94

LHRECORD: .WK? File Conversion Information

95

LHNGRAPH: Named Graph Information

96

SOUND: Sound Note

98

LPR: Sheet Was Printed Using LINE.PRINT( )

99

STANDARDWIDTH: Standard Column Width

9A

FNGROUPNAME: Function Group Name

9B

FILTERMODE: Sheet Contains Filtered List

9C

FNGROUPCOUNT: Built-in Function Group Count

9D

AUTOFILTERINFO: Drop-Down Arrow Count

9E

AUTOFILTER: AutoFilter Data

A0

SCL: Window Zoom Magnification

A1

SETUP: Page Setup

A9

COORDLIST: Polygon Object Vertex Coordinates

AB

GCW: Global Column Width Flags

AE

SCENMAN: Scenario Output Data

AF

SCENARIO: Scenario Data

B0

SXVIEW: View Definition

B1

SXVD: View Fields

B2

SXVI: View Item

B4

SXIVD: Row/Column Field IDs

B5

SXLI: Line Item Array

B6

SXPI: Page Item

B8

DOCROUTE: Routing Slip Information

B9

RECIPNAME: Recipient Name

BC

SHRFMLA: Shared Formula

BD

MULRK: Multiple RK Cells

BE

MULBLANK: Multiple Blank Cells

C1

MMS: ADDMENU/DELMENU Record Group Count

C2

ADDMENU: Menu Addition

C3

DELMENU: Menu Deletion

C5

SXDI: Data Item

CD

SXSTRING: String

D0

SXTBL: Multiple Consolidation Source Info

D1

SXTBRGIITM: Page Item Name Count

D2

SXTBPG: Page Item Indexes

D3

OBPROJ: Visual Basic Project

D5

SXIDSTM: Stream ID

D6

RSTRING: Cell with Character Formatting

D7

DBCELL: Stream Offsets

DA

BOOKBOOL: Workbook Option Flag

DC

SXEXT: External Source Information

DD

SCENPROTECT: Scenario Protection

DE

OLESIZE: Size of OLE Object

DF

UDDESC: Description String for Chart Autoformat

E0

XF: Extended Format

E1

INTERFACEHDR: Beginning of User Interface Records

E2

INTERFACEEND: End of User Interface Records

E3

SXVS: View Source

EAh

TABIDCONF: Sheet Tab ID of Conflict History (BIFF7)


Record Descriptions

The first two fields in every BIFF record are record number and record length. Because these fields have the same offset and size in every BIFF record, they're not documented in the following descriptions. For more information about the record number and record length fields, see BIFF Record Information.

1904: 1904 Date System (22h)

The 1904 record stores the date system used by Microsoft Excel.

Record Data

Offset

Name

Size

Contents

4

f1904

2

= 1 if the 1904 date system is used


ADDIN: Workbook Is an Add-in Macro (87h)

This record has no record data field. If the ADDIN record is present in the BIFF file, it signifies that the macro is an add-in macro. The ADDIN record, if present, must immediately follow the first BOF record in the Book stream.

ADDMENU: Menu Addition (C2h)

The ADDMENU record stores a menu addition. When you add a menu object (a menu bar, a menu, a menu item, or a submenu item) to the user interface, Microsoft Excel writes a group of ADDMENU records for each object. The first record stores the menu bar, the second stores the menu, the third stores the menu item, and the fourth stores the submenu item (note how this is identical to the menu hierarchy in the user interface). The number of records in the group depends on the level of the menu structure at which the addition occurs. For example, adding a menu to a menu bar causes two ADDMENU records to be written. Adding a submenu item to a menu item causes four records to be written.

If fInsert is true (equal to 01h), the menu object is added at this level of the hierarchy. For example, if fInsert is true in the second ADDMENU record of the group, Microsoft Excel adds a new menu to an existing menu bar. If fInsert is false (equal to 00h), the record is a placeholder, and one of the following ADDMENU records in the group will define the menu addition.

For menu items and submenu items, the icetab field stores the index to the added command, if the item is attached to a built-in command. The icetabBefore field stores the index to the command before which the new command is added. If either of these indexes equals FFFFh, the corresponding string from the rgch field is used instead of a built-in command.

The caitm field is equal to the number of following ADDMENU records that are to be inserted at this level of the menu hierarchy.

Record Data

Offset

Name

Size

Contents

4

icetabItem

2

Icetab of the command

6

icetabBefore

2

Icetab of the existing command before which the new command is inserted

8

caitm

1

Number of ADDMENU records at the next level of the menu hierarchy

9

fInsert

1

= 1, insert this menu object
= 0, this is a placeholder record

10

rgch

var

stItem, stBefore, stMacro, stStatus, stHelp strings (see text)


The rgch field stores five concatenated strings, as described in the following table. Null strings will appear in the rgch field as a single byte (00h).

String

Contents

stItem

Text of the menu object

stBefore

Text of the item before which this item is added

stMacro

Macro name, encoded using a technique similar to the encoded filenames in the EXTERNSHEET record (for more information, see EXTERNSHEET)

stStatus

Status bar text (for add-ins)

stHelp

Help filename and context ID (for add-ins)


ARRAY: Array-Entered Formula (221h)

An ARRAY record describes a formula that was array-entered into a range of cells. The range of cells in which the array is entered is defined by the rwFirst, rwLast, colFirst, and colLast fields.

The ARRAY record occurs directly after the FORMULA record for the cell in the upper-left corner of the array — that is, the cell defined by the rwFirst and colFirst fields.

The parsed expression is the array formula, stored in the Microsoft Excel internal format. For an explanation of the parsed format, see Microsoft Excel Formulas.

Record Data

Offset

Name

Size

Contents

4

rwFirst

2

First row of the array

6

rwLast

2

Last row of the array

8

colFirst

1

First column of the array

9

colLast

1

Last column of the array

10

grbit

2

Option flags

12

chn

4

(See text)

16

cce

2

Length of the parsed expression

18

rgce

var

Parsed expression


You should ignore the chn field when you read the BIFF file. If you write a BIFF file, the chn field must be 00000000h.

The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fAlwaysCalc

Always calculate the formula.

1

02h

fCalcOnLoad

Calculate the formula when the file is opened.

7–2

FCh

(unused)

1

7–0

FFh

(unused)


AUTOFILTER: AutoFilter Data (9Eh) (Changed for BIFF7)

This record stores data for an active AutoFilter.

Record Data—BIFF5

Offset

Name

Size

Contents

4

iEntry

2

Index of the active AutoFilter

6

grbit

2

Option flags

8

doper1

10

DOPER structure for first filter condition (see text)

18

doper2

10

DOPER structure for the second filter condition (see text)

28

rgch

var

String storage for vtString DOPER (see text)


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

1-0

03h

wJoin

= 1 if the custom filter conditions are ANDed
= 0 if the custom filter conditions are ORed

2

04h

fSimple1

= 1 if the first condition is a simple equality (for optimization)

3

08h

fSimple2

= 1 if the second condition is a simple equality (for optimization)

7-4

F0h

(Reserved)

1

7-0

FFh

(Reserved)


Record Data—BIFF7

Offset

Name

Size

Contents

4

iEntry

2

Index of the active AutoFilter

6

grbit

2

Option flags

8

doper1

10

DOPER structure for the first filter condition (see text)

18

doper2

10

DOPER structure for the second filter condition (see text)

28

rgch

var

String storage for vtString DOPER (see text)


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

1-0

0003h

wJoin

= 1 if the custom filter conditions are ANDed
= 0 if the custom filter conditions are ORed

2

0004h

fSimple1

= 1 if the first condition is a simple equality (for optimization)

3

0008h

fSimple2

= 1 if the second condition is a simple equality (for optimization)

4

0010h

fTop10

= 1 if the condition is a Top 10 AutoFilter

5

0020h

fTop

= 1 if the Top 10 AutoFilter shows the top items; = 0 if it shows the bottom items

6

0040h

fPercent

= 1 if the Top 10 AutoFilter shows percentage; = 0 if it shows items

15-7

FF80h

wTop10

The number of items to show (from 1 to 500 decimal, expressed as a binary number)


DOPER Structures—BIFF5 and BIFF7

The database oper structures (DOPERs) are 10-byte parsed definitions of the filter conditions that appear in the Custom AutoFilter dialog box. The DOPER structures are defined in the following sections.

DOPER Structure for RK Numbers (vt = 02h)

Offset

Name

Size

Contents

0

vt

1

Data type (see text)

1

grbitSgn

1

Comparison code (see text)

2

rk

4

RK number (see RK)

6

(reserved)

4


DOPER Structure for IEEE Floating-Point Numbers (vt = 04h)

Offset

Name

Size

Contents

0

vt

1

Data type (see text)

1

grbitSgn

1

Comparison code (see text)

2

num

8

IEEE floating-point number


DOPER Structure for Strings (vt = 06h)

Offset

Name

Size

Contents

0

vt

1

Data type (see text)

1

grbitSgn

1

Comparison code (see text)

2

(reserved)

4

6

cch

1

Length of the string (the string is stored in rgch field that follows the DOPER structures)

7

(reserved)

3


DOPER Structure for Boolean and Error Values (vt = 08h)

Offset

Name

Size

Contents

0

vt

1

Data type (see text)

1

grbitSgn

1

Comparison code (see text)

2

fError

1

Boolean/error flag

3

bBoolErr

1

Boolean value or error value

4

(reserved)

6


The bBoolErr field contains the Boolean or error value, as determined by the fError field. If the fError field contains a 0 (zero), the bBoolErr field contains a Boolean value; if the fError field contains a 1, the bBoolErr field contains an error value.

Boolean values are 1 for true and 0 for false.

Error values are listed in the following table.

Error value

Value (hex)

Value (dec.)

#NULL!

00h

0

#DIV/0!

07h

7

#VALUE!

0Fh

15

#REF!

17h

23

#NAME?

1Dh

29

#NUM!

24h

36

#N/A

2Ah

42


The vt field contains the data type of the DOPER, as shown in the following table. For the DOPER types 00h, 0Ch, and 0Eh, the remaining 9 bytes of the DOPER are ignored.

vt

DOPER type

00h

Filter condition not used

02h

RK number

04h

IEEE number

06h

String

08h

Boolean or error value

0Ch

Match all blanks

0Eh

Match all non-blanks


The grbitSgn field corresponds to comparison operators, as shown in the following table.

grbitSgn

Operator

01

<

02

=

03

<=

04

>

05

<>

06

>=


AUTOFILTERINFO: Drop-Down Arrow Count (9Dh)

This record stores the count of AutoFilter drop-down arrows. Each drop-down arrow has a corresponding OBJ record. If at least one AutoFilter is active (in other words, the range has been filtered at least once), there will be a corresponding FILTERMODE record in the file. There will also be one AUTOFILTER record for each active filter.

Record Data

Offset

Name

Size

Contents

4

cEntries

2

Number of AutoFilter drop-down arrows on the sheet


BACKUP: Save Backup Version of the File (40h)

The BACKUP record specifies whether or not Microsoft Excel should save backup versions of a file.

Record Data

Offset

Name

Size

Contents

4

fBackupFile

2

= 1 if Microsoft Excel should save a backup version of the file


BLANK: Cell Value, Blank Cell (201h)

A BLANK record describes an empty cell. The rw field contains the 0-based row number. The col field contains the 0-based column number.

Record Data

Offset

Name

Size

Contents

4

rw

2

Row

6

col

2

Column

8

ixfe

2

Index to the XF record


BOF: Beginning of File (809h)

The BOF record marks the beginning of the Book stream in the BIFF file. It also marks the beginning of record groups (or "substreams" of the Book stream) for sheets in the workbook. You can determine the BIFF version from the high-order byte of the record number field, as shown in the following table.

BOF Record Number Field

Offset

Name

Size

Contents

0

vers

1

ver:
= 00 BIFF2
= 02 BIFF3
= 04 BIFF4
= 08 BIFF5/BIFF7

1

bof

1

09h


Record Data

Offset

Name

Size

Contents

4

vers

2

Version number (0500 for BIFF5 and BIFF7)

6

dt

2

Substream type:
0005h = Workbook globals
0006h = Visual Basic module
0010h = Worksheet or dialog sheet
0020h = Chart
0040h = Microsoft Excel 4.0 macro sheet
0100h = Workspace file

8

rupBuild

2

Build identifier (internal use only)

10

rupYear

2

Build year (internal use only)


The rupBuild and rupYear fields contain numbers that identify the version (build) of Microsoft Excel that wrote the file. If you write a BIFF file, you can use the BiffView utility to determine the current values of these fields by examining any BOF record in a workbook file.

BOOKBOOL: Workbook Option Flag (DAh)

This record saves a workbook option flag.

Record Data

Offset

Name

Size

Contents

4

fNoSaveSupp

2

=1 if the Save External Link Values option is turned off (Options dialog box, Calculation tab)


BOOLERR: Cell Value, Boolean or Error (205h)

A BOOLERR record describes a cell that contains a constant Boolean or error value. The rw field contains the 0-based row number. The col field contains the 0-based column number.

Record Data

Offset

Name

Size

Contents

4

rw

2

Row

6

col

2

Column

8

ixfe

2

Index to the XF record

10

bBoolErr

1

Boolean value or error value

11

fError

1

Boolean/error flag


The bBoolErr field contains the Boolean or error value, as determined by the fError field. If the fError field contains a 0 (zero), the bBoolErr field contains a Boolean value; if the fError field contains a 1, the bBoolErr field contains an error value.

Boolean values are 1 for true and 0 for false.

Error values are listed in the following table.

Error value

Value (hex)

Value (dec.)

#NULL!

00h

0

#DIV/0!

07h

7

#VALUE!

0Fh

15

#REF!

17h

23

#NAME?

1Dh

29

#NUM!

24h

36

#N/A

2Ah

42


BOTTOMMARGIN: Bottom Margin Measurement (29h)

The BOTTOM MARGIN record specifies the bottom margin in inches when a sheet is printed. The num field is in 8-byte IEEE floating-point format.

Record Data

Offset

Name

Size

Contents

4

num

8

Bottom margin


BOUNDSHEET: Sheet Information (85h)

This record stores the sheet name, sheet type, and stream position.

Record Data

Offset

Name

Size

Contents

4

lbPlyPos

4

Stream position of the start of the BOF record for the sheet

8

grbit

2

Option flags

10

cch

1

Length of the sheet name

11

rgch

var

Sheet name


The grbit field contains the options listed in the following table.

Offset

Bits

Mask

Name

Contents

0

7-0

0Fh

dt

Sheet type:
00h = worksheet or dialog sheet
01h = Microsoft Excel 4.0 macro sheet
02h = chart
06h = Visual Basic module

1

1–0

03h

hsState

Hidden state:
00h = visible
01h = hidden
02h = very hidden (see text)

7-2

FCh

(Reserved)


A Visual Basic procedure can set the Visible property of a sheet to create a very hidden sheet. A very hidden sheet can be made visible again by a Visual Basic procedure, but there is no way to make the sheet visible through the user interface of Microsoft Excel.

CALCCOUNT: Iteration Count (0Ch)

The CALCCOUNT record stores the Maximum Iterations option from the Options dialog box, Calculation tab.

Record Data

Offset

Name

Size

Contents

4

cIter

2

Iteration count


CALCMODE: Calculation Mode (0Dh)

The CALCMODE record stores options from the Options dialog box, Calculation tab.

Record Data

Offset

Name

Size

Contents

4

fAutoRecalc

2

Calculation mode:
= 0 for manual
= 1 for automatic
= –1 for automatic, except tables


CODEPAGE: Default Code Page (42h)

The CODEPAGE record stores the default code page (character set) that was in use when the workbook was saved.

Record Data

Offset

Name

Size

Contents

4

cv

2

Code page the file is saved in:
01B5h (437 dec.) = IBM PC (Multiplan)
8000h (32768 dec.) = Apple Macintosh
04E4h (1252 dec.) = ANSI (Microsoft Windows)


COLINFO: Column Formatting Information (7Dh)

The COLINFO record describes the column formatting for a range of columns.

Record Data

Offset

Name

Size

Contents

4

colFirst

2

First formatted column (0-based)

6

colLast

2

Last formatted column (0-based)

8

coldx

2

Column width, in 1/256s of a character width

10

ixfe

2

Index to XF record that contains the default format for the column (for more information about the XF records, see XF)

12

grbit

2

Options

14

(reserved)

1

Reserved; must be 0 (zero)


The grbit field contains the options listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fHidden

= 1 if the column range is hidden

7–1

FEh

(Unused)

1

2–0

07h

iOutLevel

Outline level of column range

3

08h

(Reserved)

Reserved; must be 0 (zero)

4

10h

fCollapsed

= 1 if the column range is collapsed in outlining

7–5

E0h

(Reserved)

Reserved; must be 0 (zero)


CONTINUE: Continues Long Records (3Ch)

Records that are longer than 2084 bytes (this includes the 4 bytes for record number and record length) must be split into several records. The first section appears in the base record; subsequent sections appear in CONTINUE records.

Record Data

Offset

Name

Size

Contents

4

var

Continuation of record data


COORDLIST: Polygon Object Vertex Coordinates (A9h)

This record stores the coordinates of the vertices in a polygon object.

Record Data

Offset

Name

Size

Contents

4

rgVTX

var

Array of vertex coordinates


The VTX structure is defined as follows:


typedef struct _vtx
    {
    unsigned short int x;
    unsigned short int y;
    }
        VTX;

The upper-left corner of a polygon's bounding rectangle is (x = 0h, y = 0h), and the lower-right corner is (x = 4000h, y = 4000h), as shown in the following illustration.

After the polygon is drawn, Microsoft Excel normalizes the coordinates in rgVTX to the bounding rectangle. The actual size of the polygon can be derived from the size of the bounding rectangle in the common object fields section of the OBJ record.

COUNTRY: Default Country/Region and WIN.INI Country/Region (8Ch)

This record contains localization information.

Record Data

Offset

Name

Size

Contents

4

iCountryDef

2

Default country/region index

6

iCountryWinIni

2

Country/region index from the Win.ini file


The default country/region index, iCountryDef, is determined by the localized version of Microsoft Excel that created the BIFF file. For example, all BIFF files created by the U.S. version of Microsoft Excel have iCountryDef = 1. If Microsoft Excel for Windows created the BIFF file, iCountryWinIni is equal to the index that corresponds to the country/region setting in the Win.ini file. Country/region indexes are defined in the following table.

Index

Country/Region

1

United States

2

Canada

3

Latin America, except Brazil

31

Netherlands

32

Belgium

33

France

34

Spain

39

Italy

41

Switzerland

43

Austria

44

United Kingdom

45

Denmark

46

Sweden

47

Norway

49

Germany

52

Mexico

55

Brazil

61

Australia

64

New Zealand

81

Japan

82

South Korea

351

Portugal

354

Iceland

358

Finland

785

Arabic

886

Taiwan

972

Israel


CRN: Nonresident Operands (5Ah)

The CRN record describes nonresident operands in a formula. For example, if you have a worksheet that contains the formula =EXT.XLS!A1*A3, where EXT.XLS is not the active workbook, the nonresident operand EXT.XLS!A1 generates a CRN record that describes cell A1. If the nonresident operand contains more than one row, there is one CRN record for each row. For example, if the formula =EXT.XLS!A1:A4*4 is array-entered on a worksheet, there will be four CRN records.

If a worksheet contains two different formulas and each formula has multiple nonresident operands, Microsoft Excel may create one CRN record or several CRN records, depending on how the nonresident cells are arranged. For example, suppose that a worksheet contains two formulas (in different cells), =EXT.XLS!A1*2 and =EXT.XLS!B1*2. Because the nonresident operands are in a row and are not separated by an empty cell, Microsoft Excel creates only one CRN record containing information about cells A1 and B1.

If, however, the formulas are =EXT.XLS!A1*2 and =EXT.XLS!C1*2, Microsoft Excel creates two CRN records because an empty cell (B1) separates the two operands, A1 and C1.

Record Data

Offset

Name

Size

Contents

4

colLast

1

Last column of the nonresident operand

5

colFirst

1

First column of the nonresident operand

6

rw

2

Row of the nonresident operand

8

OPER

var

OPER structure; see the following description


The OPER structure repeats for each cell in the nonresident operand. For example, the formula =SUM(EXT.XLS!A1:A3) produces one CRN record with three OPER structures.

OPER Structure If the Cell Contains a Number

Offset

Name

Size

Contents

0

grbit

1

= 01h for a cell that contains a number

1

num

8

IEEE floating-point number


OPER Structure If the Cell Contains a String

Offset

Name

Size

Contents

0

grbit

1

= 02h for a cell that contains a string

1

cch

1

Number of characters in the string

2

rgch

var

String


OPER Structure If the Cell Contains a Boolean Value

Offset

Name

Size

Contents

0

grbit

1

= 04h for a cell that contains a Boolean value

1

f

2

= 1 if TRUE
= 0 if FALSE

3

(unused)

6


OPER Structure If the Cell Contains an Error Value

Offset

Name

Size

Contents

0

grbit

1

= 10h for a cell that contains an error value

1

err

2

Error value

3

(unused)

6


DBCELL: Stream Offsets (D7h)

The DBCELL record stores stream offsets for the BIFF file. There is one DBCELL record for each block of ROW records and associated cell records. Each block can contain data for up to 32 rows. For more information about the DBCELL record, see Finding Cell Records in BIFF Files.

Record Data

Offset

Name

Size

Contents

4

dbRtrw

4

Offset from the start of the DBCELL record to the start of the first ROW record in the block; this is an offset to an earlier position in the stream.

8

rgdb

var

Array of stream offsets (2 bytes each). For more information, see Finding Cell Records in BIFF Files


DCON: Data Consolidation Information (50h)

The DCON record stores options from the Consolidate dialog box (Data menu).

Record Data

Offset

Name

Size

Contents

4

iiftab

2

Index to the data consolidation function (see the following table)

6

fLeftCat

2

= 1 if the Left Column option is turned on

8

fTopCat

2

= 1 if the Top Row option is turned on

10

fLinkConsol

2

= 1 if the Create Links To Source Data option is turned on


The iiftab field, described in the following table, corresponds to the Function option in the Consolidate dialog box (Data menu).

Function

Iiftab

Average

0

Count Nums

1

Count

2

Max

3

Min

4

Product

5

StdDev

6

StdDevp

7

Sum

8

Var

9

Varp

10


DCONNAME: Data Consolidation Named References (52h)

The DCONREF record contains the complete description of a named range of cells for the Consolidate command (Data menu). The stFile field contains an encoded workbook name; for information about this field, see EXTERNSHEET.

Record Data

Offset

Name

Size

Contents

4

cchName

1

Length of the named range of the source area

5

stName

var

Named range of the source area for consolidation

var

cchFile

1

Length of the workbook name

var

stFile

var

Workbook name


DCONREF: Data Consolidation References (51h)

The DCONNAME record contains the complete description of a range of cells for the Consolidate command (Data menu). The rgch field contains an encoded workbook name; for information about this field, see EXTERNSHEET

Record Data

Offset

Name

Size

Contents

4

rwFirst

2

First row of the source area for consolidation

6

rwLast

2

Last row of the source area for consolidation

8

colFirst

1

First column of the source area for consolidation

9

colLast

1

Last column of the source area for consolidation

10

cch

1

Length of the workbook name

11

rgch

1

Workbook name


DEFAULTROWHEIGHT: Default Row Height (225h)

The DEFAULTROWHEIGHT record specifies the height of all undefined rows on the sheet. The miyRw field contains the row height in units of 1/20th of a point. This record does not affect the row height of any rows that are explicitly defined.

Record Data

Offset

Name

Size

Contents

4

grbit

2

Option flags (see the following table)

6

miyRw

2

Default row height


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fUnsynced

= 1 if all undefined rows have incompatible font height and row height

1

02h

fDyZero

= 1 if all undefined rows have 0 (zero) height

2

04h

fExAsc

= 1 if all undefined rows have an extra space above

3

08h

fExDsc

= 1 if all undefined rows have an extra space below

7–4

F0h

(Unused)

1

7–0

FFh

(Unused)


DEFCOLWIDTH: Default Width for Columns (55h)

The DEFCOLWIDTH record specifies the width, measured in characters, for columns not explicitly sized in the COLWIDTH record.

Record Data

Offset

Name

Size

Contents

4

cchdefColWidth

2

Default width of the columns


DELMENU: Menu Deletion (C3h)

The DELMENU record stores a menu deletion and is very similar to the ADDMENU record. For more information about menu system modification, see ADDMENU.

If fDelete is true (equal to 01h), the menu object is deleted at this level of the hierarchy. For example, if fDelete is true in the second DELMENU record of the group, Microsoft Excel deletes the specified menu from a menu bar. If fDelete is false (equal to 00h), the record is a placeholder, and one of the following DELMENU records in the group will define the menu deletion.

For menu items and submenu items, the icetabItem field stores the index to the deleted command if the item is attached to a built-in command. If icetabItem equals FFFFh, the stItem string from the rgch field is used instead.

Record Data

Offset

Name

Size

Contents

4

icetabItem

2

Icetab of the command

6

cditm

1

Number of DELMENU records at the next level of the menu hierarchy

7

fDelete

1

= 1, delete this menu object
= 0, this is a placeholder record

8

fMultiple

1

= 1 if this item has subitems

9

rgch

var

stItem (see text)


The first byte of the stItem string is the byte count, and the last byte is reserved.

DELTA: Iteration Increment (10h)

The DELTA record stores the Maximum Change value from the Options dialog box, Calculation tab. The number is in 8-byte IEEE floating-point format.

Record Data

Offset

Name

Size

Contents

4

numDelta

8

Maximum iteration change


DIMENSIONS: Cell Table Size (200h)

The DIMENSIONS record contains the minimum and maximum bounds of the sheet. It provides a concise indication of the sheet size.

Note that both the rwMac and colMac fields are greater by 1 than the actual last row and column. For example, a worksheet that exists between cells B3 and D6 would have the following dimensions in the dimensions record (note rows and columns are 0-based in BIFF files in which row 1 and column A are both coded as 0):

rwMic = 2 — indicates that 3 is the first row

colMic = 1 — indicates that B is the first column

rwMac = 6 — indicates that 6 is the last row

colMac = 4 — indicates that D is the last column

Record Data

Offset

Name

Size

Contents

4

rwMic

2

First defined row on the sheet

6

rwMac

2

Last defined row on the sheet, plus 1

8

colMic

2

First defined column on the sheet

10

colMac

2

Last defined column on the sheet, plus 1

12

(Reserved)

2

Reserved; must be 0 (zero)


DOCROUTE: Routing Slip Information (B8h)

This record stores originator information for a routing slip and other information for document routing. The rgch field contains the concatenation of seven null-terminated strings: Subject, Message, Route ID, Custom Message Type, Book Title, Originator's Friendly Name, and Originator's System-Specific Address. The lengths of the strings are contained in the seven fields, cchSubject through ulEIDSize.

Record Data

Offset

Name

Size

Contents

4

iStage

2

Routing stage

6

cRecip

2

Number of recipients

8

delOption

2

Delivery option:
= 0, one at a time
= 1, all at once

10

wFlags

2

Option flags

12

cchSubject

2

Length of the Subject string

14

cchMessage

2

Length of the Message string

16

cchRouteID

2

Length of the Route ID string

18

cchCustType

2

Length of the Custom Message Type string

20

cchBookTitle

2

Length of the Book Title string

22

cchOrg

2

Length of the Originator's Friendly Name string

24

ulEIDSize

4

Length of the Originator's System-Specific Address string

28

rgch

var

(See text)


The wFlags field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fRouted

= 1 if the document has been routed

1

02h

fReturnOrig

= 1 if the document should be returned to its originator

2

04h

fTrackStatus

= 1 if the status message should be sent

3

08h

fCustomType

= 1 if the status message is a custom message type

6-4

70h

(Reserved)

7

80h

fSaveRouteInfo

= 1 if the routing slip information should be saved

1

7-0

FFh

(Reserved)


EDG: Edition Globals (88h)

The EDG record contains information about the publisher/subscriber feature. This record can be created only by Microsoft Excel for the Macintosh. However, if any other platform version of Microsoft Excel encounters the EDG record in a BIFF file, it leaves the record in the file, unchanged, when the file is saved.

Record Data

Offset

Name

Size

Contents

4

lcsec

4

Count of all section records that have ever been created in this document, plus 1 (includes published embedded charts)

8

crtpub

2

Count of all PUB records in the file (includes published embedded charts)

10

(Reserved)

2

Reserved; must be 0 (zero)


EOF: End of File (0Ah)

The EOF record marks the end of the workbook stream or the end of one of the substreams in the workbook stream. It has no record data field and is simply 0A000000h.

EXTERNCOUNT: Number of External References (16h)

The EXTERNCOUNT record specifies the number of externally referenced workbooks, DDE references, and OLE references contained in a Microsoft Excel workbook.

For example, a worksheet contains the following formulas in cells A1:A3:

=SALES.XLS!Profits

=Signal|System!Formats

=Signal|StockInfo!MSFT

This worksheet would have a value of 3 in the cxals field of the EXTERNCOUNT record, corresponding to the three external references SALES.XLS, Signal|System, and Signal|StockInfo.

Record Data

Offset

Name

Size

Contents

4

cxals

2

Number of external references


EXTERNNAME: Externally Referenced Name (223h)

The EXTERNNAME record stores an externally referenced name, DDE link, or OLE link. All EXTERNNAME records associated with a supporting workbook must directly follow the EXTERNSHEET record for the workbook. The order of EXTERNNAME records in a BIFF file should not be changed.

External Name

When the EXTERNNAME record stores an external name, fOle and fOleLink are both equal to zero (FALSE), and the record has the form shown in the following table.

Offset

Name

Size

Contents

4

grbit

2

Option flags

6

(Reserved)

4

Reserved; must be 0 (zero)

10

cch

1

Length of the external name

11

rgch

var

External name

var

cce

2

Length of the name definition

var

rgce

var

Name definition, in parsed expression format; for more information, see Microsoft Excel Formulas.


The grbit field contains the option flags listed in the following table.

Bits

Mask

Name

Contents

0

0001h

fBuiltin

= 1 if the name is a built-in name

1

0002h

fWantAdvise

N/A for External Names (must be 0 (zero))

2

0004h

fWantPict

N/A for External Names (must be 0 (zero))

3

0008h

fOle

N/A for External Names (must be 0 (zero))

4

0010h

fOleLink

N/A for External Names (must be 0 (zero))

15-5

FFE0h

(reserved)

Reserved; must be 0 (zero)


DDE Link

When the EXTERNNAME record stores a DDE link, the record has the form shown in the following table.

Offset

Name

Size

Contents

4

grbit

2

Option flags

6

(Reserved)

4

Reserved; must be 0 (zero)

10

cch

1

Length of the external name

11

rgch

var

External name

var

rgoper

var

Array of OPERs that stores the current value of the name


The grbit field contains the option flags listed in the following table.

Bits

Mask

Name

Contents

0

0001h

fBuiltin

N/A for DDE links (must be 0 (zero))

1

0002h

fWantAdvise

= 0 for manual DDE links
= 1 for automatic DDE links

2

0004h

fWantPict

= 1 if Microsoft Excel wants a cfPict clipboard format representation of the data; OBJ and IMDATA records store the image

3

0008h

fOle

= 1 if this record stores the OLE StdDocumentName identifier (no rgoper follows rgch)

4

0010h

fOleLink

= 0 for DDE links

14-5

7FE0h

cf

The clipboard format for which the DDE Advise succeeded; this is used to reduce the time required for future Advise cycles

15

8000h

(Reserved)

Reserved; must be 0 (zero)


OLE Link

When the EXTERNNAME record stores an OLE link, fWantAdvise and fOleLink are equal to 1 (TRUE), and the record has the form shown in the following table.

Offset

Name

Size

Contents

4

grbit

2

Option flags

6

lStgName

4

OLE 2 storage identifier

10

cch

1

Length of the link name

11

rgch

var

Link name


The grbit field contains the option flags listed in the following table.

Bits

Mask

Name

Contents

0

0001h

fBuiltin

N/A for OLE links (must be 0 (zero))

1

0002h

fWantAdvise

= 0 for manual OLE links
= 1 for automatic OLE links

2

0004h

fWantPict

= 1 if Microsoft Excel wants a cfPict clipboard format representation of the data; OBJ and IMDATA records store the image

3

0008h

fOle

N/A for OLE links (must be 0 (zero))

4

0010h

fOleLink

= 1 for OLE links

15-5

FFE0h

(Reserved)

Reserved; must be 0 (zero)


EXTERNSHEET: External Reference (17h)

The EXTERNSHEET record specifies an externally referenced workbook. The cxals field of the EXTERNCOUNT record specifies the number of EXTERNSHEET records. You should not change the order of EXTERNSHEET records.

An externally referenced workbook is called a source workbook. The workbook that refers to it is called a dependent workbook.

Record Data

Offset

Name

Size

Contents

4

cch

1

Length of the filename

5

rgch

var

Filename


The cch field contains the length of the source workbook filename. The rgch field contains the source workbook filename.

Filename Encoding

Whenever possible, filenames are encoded to make BIFF files transportable across file systems. Encoded filenames are identified by the first character of the rgch field. The first character of the rgch field may be any one of the values listed in the following table.

Name

Value

Meaning

chEmpty

00

Reference to an empty workbook name (see text)

chEncode

01

Filename has been encoded (see the following table)

chSelf

02

Self-referential external reference (see text)


chEmpty indicates that the filename is an external reference to an empty workbook name, as in the formula =Sheet1!$A$1.

chSelf indicates that the filename is an external reference in which the dependent and source workbooks are the same. An example of this is the workbook SALES.XLS, which contains the formula =SALES.XLS!$A$1.

A chDDE key (03h) can occur in the rgch field; it is not necessarily the first character in the field, as are chEmpty, chEncode, and chSelf. This key indicates that the external reference is a DDE or OLE link. In a DDE link, the chDDE key replaces the | (pipe) character that separates the DDE application and topic. In an OLE link, chDDE separates the classname and filename.

A chEncode at the beginning of rgch indicates that the filename of the source workbook has been encoded to a less system-dependent filename. The special keys listed in the following table are recognized in the rgch field.

Name

Value

PC file systems

Macintosh file system

chVolume

01

Represents an MS-DOS drive letter. It is followed
by the drive letter. For example, the formula ='D:\SALES.XLS'!A1 generates the chVolume key when the dependent workbook is not on the D
drive. UNC filenames, such as
\\server\share\myfile.xls,
generate an @ character after the chVolume key; this replaces the initial double backslash (\\).

Represents a single-character volume name. Because single-character volume names are uncommon on the Macintosh, the chLongVolume key is used to represent volume names that are longer than a single character.

chSameVolume

02

Indicates that the source workbook is on the same drive as the dependent workbook (the drive letter is omitted). For example,
the formula ='\SALES.XLS'!A1 generates the chSameVolume key when the dependent workbook is not in the root directory.

Indicates that the source workbook is in the same volume as the dependent workbook (the volume name is omitted).

ChDownDir

03

Indicates that the source workbook is in a subdirectory of the current directory. For example,
the formula ='XL\SALES.XLS'!A1 generates the chDownDir key. The subdirectory name precedes the chDownDir key, and the filename follows it.

Indicates that the source workbook is in a folder in the current folder. For example, the formula =':XL:Sales1992'!A1 generates the chDownDir key. The folder name precedes the chDownDir key, and the filename follows it.

chUpDir

04

Indicates that the source workbook is in the parent directory of the current directory. For example,
the formula ='..\SALES.XLS'!A1 generates the chUpDir key.

Indicates that the source workbook is in the parent folder of the current folder. For example, the formula ='::Sales1992'!A1 generates the chUpDir key.

chLongVolume

05

(Not used)

The chLongVolume key is followed by the length of the name (1 byte) and then by the volume name string.

chStartupDir

06

Indicates that the source workbook is in the startup directory (the Xlstart subdirectory of the directory that contains Excel.exe).

Indicates that the source workbook is in the Excel Startup Folder (5), which is in the System Folder.

chAltStartupDir

07

Indicates that the source workbook is in the alternate startup directory.

Indicates that the source workbook is in the alternate startup folder.

chLibDir

08

Indicates that the source workbook is in the Library directory.

Indicates that the source workbook is in the Macro Library folder.


FILEPASS: File Is Password-Protected (2Fh)

If you type a protection password (File menu, Save As command, Options dialog box), the FILEPASS record appears in the BIFF file. The wProtPass field contains the encrypted password. All records after FILEPASS are encrypted; you cannot read these encrypted records.

Note that this record specifies a file protection password, as opposed to the PASSWORD record (type 13h), which specifies a sheet-level or workbook-level protection password.

Record Data

Offset

Name

Size

Contents

4

wProtPass

4

Encrypted password


FILESHARING: File-Sharing Information (5Bh)

This record stores file-sharing options selected in the Options dialog box, accessed by using the Save As command (File menu). The write reservation password that you type in the dialog box is encrypted to an integer, wResPass. This record also contains the user name of the file's creator, stUNWriteRes.

Changes for BIFF7

There are minor changes to the behavior of this record in BIFF7. For Microsoft Excel version 7.0 workbooks that do not contain shared lists, this record behaves as it does in BIFF5.

For Microsoft Excel version 7.0 workbooks that contain shared lists, there will be both FILESHARING and FILESHARING2 records in the Book stream. In this case, FILESHARING always contains a dummy password. FILESHARING2 contains either a dummy password if the workbook is not write protected, or a valid password if the workbook is write protected.

Record Data

Offset

Name

Size

Contents

4

fReadOnlyRec

2

= 1 if the Read Only Recommended option is selected in the Options dialog box

6

wResPass

2

Encrypted password (if this field is 0 (zero), there is no write reservation password)

8

cch

1

Length of the user name

9

stUNWriteRes

var

User name


FILESHARING2: File-Sharing Information for Shared Lists (1A5h) (New for BIFF7)

In Microsoft Excel version 7.0 workbooks that contain shared lists, FILESHARING2 contains either a dummy password if the workbook is not write protected, or a valid password if the workbook is write-protected. If the workbook does not contain shared lists, this record does not appear in the file.

This record does not appear in BIFF5 files.

Record Data

Offset

Name

Size

Contents

4

fReadOnlyRec

2

= 1 if the Read Only Recommended option is selected in the Options dialog box

6

wResPass

2

Encrypted password (if this field is 0 (zero), there is no write reservation password)

8

cch

1

Length of the user name

9

stUNWriteRes

var

User name


FILTERMODE: Sheet Contains Filtered List (9Bh)

If the sheet contains a filtered list, the file will contain a FILTERMODE record. This record has no record data field.

FNGROUPCOUNT: Built-in Function Group Count (9Ch)

This record stores the number of built-in function groups (Financial, Math & Trig, Date & Time, and so on) in the current version of Microsoft Excel.

Record Data

Offset

Name

Size

Contents

4

cFnGroup

2

Number of built-in function groups


FNGROUPNAME: Function Group Name (9Ah)

This record stores the name of a custom function category.

Record Data

Offset

Name

Size

Contents

4

cch

1

Size of the function category name

5

rgch

var

Function category name


FONT: Font Description (231h)

The workbook font table contains at least five FONT records. FONT records are numbered as follows: ifnt = 00h (the first FONT record in the table), ifnt = 01h, ifnt = 02h, ifnt = 03h, ifnt = 05h (minimum table), and then ifnt = 06h, ifnt = 07h, and so on. Notice that ifnt = 04h never appears in a BIFF file. This is for backward-compatibility with previous versions of Microsoft Excel. If you read FONT records, remember to index the table correctly, skipping ifnt = 04h.

Record Data

Offset

Name

Size

Contents

4

dyHeight

2

Height of the font (in units of 1/20th of a point).

6

grbit

2

Font attributes (see the following table).

8

icv

2

Index to the color palette.

10

bls

2

Bold style; a number from 100dec to 1000dec (64h to 3E8h) that indicates the character weight ("boldness"). The default values are 190h for normal text and 2BCh for bold text.

12

sss

2

Superscript/subscript:
00h = None
01h = Superscript
02h = Subscript

14

uls

1

Underline style:
00h = None
01h = Single
02h = Double
21h = Single Accounting
22h = Double Accounting

15

bFamily

1

Font family, as defined by the Windows API LOGFONT structure.

16

bCharSet

1

Character set, as defined by the Windows API LOGFONT structure.

17

(Reserved)

1

Reserved; must be 0 (zero).

18

cch

1

Length of the font name.

19

rgch

var

Font name.


The grbit field contains the font attributes listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

(Reserved)

Reserved; must be 0 (zero)

1

02h

fItalic

= 1 if the font is italic

2

04h

(Reserved)

Reserved; must be 0 (zero)

0

3

08h

fStrikeout

= 1 if the font is struck out

4

10h

fOutline

= 1 if the font is outline style (Macintosh only)

5

20h

fShadow

= 1 if the font is shadow style (Macintosh only)

7-6

C0h

(Reserved)

Reserved; must be 0 (zero)

1

7–0

FFh

(Unused)


FOOTER: Print Footer on Each Page (15h)

The FOOTER record stores a print footer string for a sheet. This string appears at the bottom of every page when the sheet is printed.

Record Data

Offset

Name

Size

Contents

4

cch

1

Length of the footer string (bytes)

5

rgch

var

Footer string


FORMAT: Number Format (41Eh)

The FORMAT record describes a number format in the workbook.

All the FORMAT records should appear together in a BIFF file. The order of FORMAT records in an existing BIFF file should not be changed. You can write custom number formats in a file, but they should be added at the end of the existing FORMAT records.

Record Data

Offset

Name

Size

Contents

4

ifmt

2

Format index code (for internal use only)

6

cch

1

Length of the format string

7

rgch

var

Number format string


Microsoft Excel uses the ifmt field to identify built-in formats when it reads a file that was created by a different localized version.

FORMULA: Cell Formula (406h)

A FORMULA record describes a cell that contains a formula.

Record Data

Offset

Name

Size

Contents

4

rw

2

Row

6

col

2

Column

8

ixfe

2

Index to XF record

10

num

8

Current value of the formula (see text)

18

grbit

2

Option flags

20

chn

4

(See text)

24

cce

2

Length of the parsed expression

26

rgce

var

Parsed expression


The chn field should be ignored when you read the BIFF file. If you write a BIFF file, the chn field must be 00000000h.

The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fAlwaysCalc

Always calculate the formula.

1

02h

fCalcOnLoad

Calculate the formula when the file is opened.

2

04h

(Reserved)

3

08h

fShrFmla

= 1 if the formula is part of shared formula group.

7–4

F0h

(Unused)

1

7–0

FFh

(Unused)


For more information about shared formulas, see SHRFMLA.

The rw field contains the 0-based row number. The col field contains the 0-based column number.

If the formula evaluates to a number, the num field contains the current calculated value of the formula in 8-byte IEEE format. If the formula evaluates to a string, a Boolean value, or an error value, the most-significant 2 bytes of the num field are FFFFh.

A Boolean value is stored in the num field, as shown in the following table. For more information about Boolean values, see BOOLERR.

Offset

Name

Size

Contents

0

otBool

1

= 1 always

1

(Reserved)

1

Reserved; must be 0 (zero)

2

f

1

Boolean value

3

(Reserved)

3

Reserved; must be 0 (zero)

6

fExprO

2

= FFFFh


An error value is stored in the num field, as shown in the following table. For more information about error values, see BOOLERR.

Offset

Name

Size

Contents

0

otErr

1

= 2 always

1

(Reserved)

1

Reserved; must be 0 (zero)

2

err

1

Error value

3

(Reserved)

3

Reserved; must be 0 (zero)

6

fExprO

2

= FFFFh


If the formula evaluates to a string, the num field has the structure shown in the following table.

Offset

Name

Size

Contents

0

otString

1

= 0 always

1

(Reserved)

5

Reserved; must be 0 (zero)

6

fExprO

2

= FFFFh


The string value is not stored in the num field; instead, it is stored in a STRING record that immediately follows the FORMULA record.

The cce field contains the length of the formula. The rgce field contains the formula in its parsed format. For more information, see Microsoft Excel Formulas.

GCW: Global Column-Width Flags (ABh)

This record contains an array of 256 flag bits, where each bit represents a column on the sheet. If a bit is true, it means that the corresponding column has the Use Standard Width option turned on. If a bit is false, it means that the column has the Use Standard Width option turned off. If the Standard Width measurement has been changed (that is, if it is no longer the default), Microsoft Excel writes a STANDARDWIDTH record.

Record Data

Offset

Name

Size

Contents

4

cb

2

Number of bytes in the global column-width flags

6

grbitGCW

2

Global column-width flags for columns A through P

8

grbitGCW

2

Global column-width flags for columns Q through AF

...

...

...

...

4+cb

grbitGCW

2

Global column-width flags for columns IG through IV


The grbitGCW field contains the option flags listed in the following table.

Bits

Mask

Name

Contents

0 (LSB)

0001h

fGCWcol1

Flag for column 1 (for example, column A)

1

0002h

fGCWcol2

Flag for column 2 (for example, column B)

2

0004h

fGCWcol3

Flag for column 3 (for example, column C)

...

...

...

...

15

8000h

fGCWcol16

Flag for column 16 (for example, column P)


GRIDSET: State Change of Gridlines Option (82h)

This record indicates that the user changed the state of the Gridlines option in the Page Setup dialog box, Sheet tab.

Record Data

Offset

Name

Size

Contents

4

fGridSet

2

= 1 if the user has ever changed the setting of the Gridlines option


GUTS: Size of Row and Column Gutters (80h)

This record contains the size of the row and column gutters, measured in screen units. The row and column gutters are the spaces that contain outline symbols. They are located above column headings and to the left of row headings.

Record Data

Offset

Name

Size

Contents

4

dxRwGut

2

Size of the row gutter that appears to the left of the rows

6

dyColGut

2

Size of the column gutter that appears above the columns

8

iLevelRwMac

2

Maximum outline level (for the row gutter)

10

iLevelColMac

2

Maximum outline level (for the column gutter)


HCENTER: Center Between Horizontal Margins (83h)

If the Horizontally option is selected on the Margins tab in the Page Setup dialog box, fHCenter = 1.

Record Data

Offset

Name

Size

Contents

4

fHCenter

2

= 1 if the sheet is to be centered between horizontal margins when printed


HEADER: Print Header on Each Page (14h)

The HEADER record specifies a print header string for a sheet. This string appears at the top of every page when the sheet is printed.

Record Data

Offset

Name

Size

Contents

4

cch

1

Length of the header string (bytes)

5

rgch

var

Header string


HIDEOBJ: Object Display Options (8Dh)

The HIDEOBJ record stores options selected in the Options dialog box, View tab.

Record Data

Offset

Name

Size

Contents

4

fHideObj

2

= 2 if the Hide All option is turned on
= 1 if the Show Placeholders option is turned on
= 0 if the Show All option is turned on


HORIZONTALPAGEBREAKS: Explicit Row Page Breaks (1Bh)

The HORIZONTALPAGEBREAKS record contains a list of explicit row page breaks. The cbrk field contains the number of page breaks. The rgrw field is an array of 2-byte integers that specifies rows. Microsoft Excel sets a page break before each row contained in the list of rows in the rgrw field. The rows must be sorted in ascending order.

Record Data

Offset

Name

Size

Contents

4

cbrk

2

Number of page breaks

6

rgrw

var

Array of rows


IMDATA: Image Data (7Fh)

The IMDATA record contains the complete description of a bitmapped graphic object, such as a drawing created by a graphics tool.

Record Data

Offset

Name

Size

Contents

4

cf

2

Image format:
= 02h, Windows metafile or Macintosh PICT format
= 09h, Windows bitmap format
= 0Eh, Native format (see text)

6

env

2

Environment from which the file was written:
= 1, Microsoft Windows
= 2, Apple Macintosh

8

lcb

4

Length of the image data

12

data

var

Image data


For more information about the Microsoft Windows metafile file format, see the documentation for the Microsoft Windows Software Development Kit.

For more information about the Apple Macintosh PICT file format, see The Programmer's Apple Mac Sourcebook (published by Microsoft Press,
ISBN 1-55615-168-3), section 2.087, "PICT File Format"; or see Inside Macintosh Volume V (published by Addison-Wesley Publishing Company, Inc., ISBN 0-201-17719-6).

If the image is in Microsoft Windows bitmap format (cf = 09h), the data field consists of a BITMAPCOREINFO data structure followed by the actual bitmap. The BITMAPCOREINFO data structure consists of a BITMAPCOREHEADER structure, followed by an array of RGBTRIPLE structures that define the color table. For more information about these structures, see the documentation for the Microsoft Windows Software Development Kit.

Native format (cf = 0Eh) stores an embedded object from another application. The image data is in the foreign application's format and cannot be directly processed by Microsoft Excel.

INDEX: Index Record (20Bh)

Microsoft Excel writes an INDEX record immediately after the BOF record for each worksheet substream in a BIFF file. For more information about the INDEX record, see Finding Cell Records in BIFF Files.

Record Data

Offset

Name

Size

Contents

4

(Reserved)

4

Reserved; must be 0 (zero)

8

rwMic

2

First row that exists on the sheet

10

rwMac

2

Last row that exists on the sheet, plus 1

12

(Reserved)

4

Reserved; must be 0 (zero)

16

rgibRw

var

Array of file offsets to the DBCELL records for each block of ROW records. A block contains ROW records for up to 32 rows. For more information, see Finding Cell Records in BIFF Files.


The rwMic field contains the number of the first row in the sheet that contains a value or a formula that is referenced by a cell in some other row. Because rows (and columns) are always stored 0-based rather than 1-based (as they appear on the screen), cell A1 is stored as row 0; cell A2 is row 1, and so on. The rwMac field contains the 0-based number of the last row in the sheet, plus 1.

INTERFACEEND: End of User Interface Records (E2h)

This records marks the end of the user interface section of the Book stream. It has no record data field.

INTERFACEHDR: Beginning of User Interface Records (E1h)

This records marks the beginning of the user interface section of the Book stream. It has no record data field.

ITERATION: Iteration Mode (11h)

The ITERATION record stores the Iteration option from the Options dialog box, Calculation tab.

Record Data

Offset

Name

Size

Contents

4

fIter

2

= 1 if the Iteration option is on


LABEL: Cell Value, String Constant (204h)

A LABEL record describes a cell that contains a string constant. The rw field contains the 0-based row number. The col field contains the 0-based column number. The string length is contained in the cch field and must be in the range of 0000h–00FFh (0–255). The string itself is contained in the rgch field.

Record Data

Offset

Name

Size

Contents

4

rw

2

Row

6

col

2

Column

8

ixfe

2

Index to the XF record

10

cch

2

Length of the string

12

rgch

var

The string


LEFTMARGIN: Left Margin Measurement (26h)

The LEFTMARGIN record specifies the width of the left margin, in inches. The num field is in 8-byte IEEE floating-point format.

Record Data

Offset

Name

Size

Contents

4

num

8

Left margin


LHNGRAPH: Named Graph Information (95h)

Record Data

This record is similar to the .WKS NGRAPH record, except that the first 13 references are not written. Instead, there are 13 integers that indicate whether the references X, A–F, and Data Label A–F are defined.

LHRECORD: .WK? File Conversion Information (94h)

This record contains information that Microsoft Excel uses when it converts an .XLS file to a .WKS, .WK1, or .WK3 file, or vice versa.

Record Data

LHRECORD contains subrecords that resemble BIFF records. Each subrecord consists of the three fields described in the following table.

Offset (within subrecord)

Length (bytes)


Contents

0

2

Subrecord type (rtlh)

2

2

Length of the subrecord data

4

var

Subrecord data


The following table describes the subrecords.

rtlh

Subrecord name

Contents

01h

(Reserved)

Reserved for future use.

02h

lhrtHpstGrHeader

Header string for the /Graph Save Print help command.

03h

lhrtHpstGrFooter

Footer string for the /Graph Save Print help command.

04h

lhrtNumGrLftMgn

Left margin for the /Graph Save Print help command (IEEE number).

05h

lhrtNumGrRgtMgn

Right margin for the /Graph Save Print help command (IEEE number).

06h

lhrtNumGrTopMgn

Top margin for the /Graph Save Print help command (IEEE number).

07h

lhrtNumGrBotMgn

Bottom margin for the /Graph Save Print help command (IEEE number).

08h

lhrtGrlh

Current /Graph View data. Structure similar to the .WKS GRAPH record except that the first 13 references are not written. Instead, there are 13 integers that indicate whether the references X, A–F, and Data Label A–F are defined.

09h

lhrtcchGlColWidth

Current global column width (integer).

0Ah

(Reserved)

Reserved for future use.

0Bh

lhrttblType

Current table type:
= 0, none (default)
= 1, table1
= 2, table2

0Ch

(Reserved)

Reserved for future use.


LPR: Sheet Was Printed Using LINE.PRINT() (98h)

If this record appears in a file, it indicates that the sheet was printed using the LINE.PRINT() macro function. The LPR record stores options associated with this function.

Record Data

Offset

Name

Size

Contents

4

grbit

2

Option flags

6

cchMargLeft

2

Left margin, expressed as a count of characters

8

cchMargRight

2

Right margin, expressed as a count of characters

10

cliMargTop

2

Top margin, expressed as a count of lines

12

cliMargBot

2

Bottom margin, expressed as a count of lines

14

cliPg

2

Number of lines per page

16

cch

1

Length of the printer setup string

17

rgch

var

Printer setup string


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fWait

= 1, alert the user after each sheet is printed

1

02h

fFormatted

= 1, print headers and footers

2

04h

fAutoLF

= 1, write only the carriage return (CR) character (no line feed) at the end of the line

7–3

F8h

(Unused)

1

7–0

FFh

(Unused)


MMS: ADDMENU/DELMENU Record Group Count (C1h)

This record stores the number of ADDMENU groups and DELMENU groups in the Book stream.

Record Data

Offset

Name

Size

Contents

4

caitm

1

Number of ADDMENU record groups

5

cditm

1

Number of DELMENU record groups


MULBLANK: Multiple Blank Cells (BEh)

The MULBLANK record stores up to the equivalent of 256 BLANK records; the MULBLANK record is a file size optimization. The number of ixfe fields can be determined from the ColLast field and is equal to (colLast - colFirst + 1). The maximum length of the MULBLANK record is (256 x 2 + 10) = 522 bytes, because Microsoft Excel has at most 256 columns. Note that storing 256 blank cells in the MULBLANK record takes 522 bytes as compared with 2560 bytes for 256 BLANK records.

Record Data

Offset

Name

Size

Contents

4

rw

2

Row number (0-based)

6

colFirst

2

Column number (0-based) of the first column of the multiple RK record

8

rgixfe

var

Array of indexes to XF records

10

colLast

2

Last column containing the BLANKREC structure


MULRK: Multiple RK Cells (BDh)

The MULRK record stores up to the equivalent of 256 RK records; the MULRK record is a file size optimization. The number of 6-byte RKREC structures can be determined from the ColLast field and is equal to (colLast - colFirst + 1). The maximum length of the MULRK record is (256 x 6 + 10) = 1546 bytes, because Microsoft Excel has at most 256 columns. Note that storing 256 RK numbers in the MULRK record takes 1546 bytes as compared with 3584 bytes for 256 RK records.

Record Data

Offset

Name

Size

Contents

4

rw

2

Row number (0-based)

6

colFirst

2

Column number (0-based) of the first column of the multiple RK record

8

rgrkrec

var

Array of 6-byte RKREC structures

var

colLast

2

Last column containing the RKREC structure


The RKREC structure is defined as follows:


typedef struct rkrec
        {
        SHORT ixfe;        /* index to XF record */
        long RK;        /* RK number */
        }
    RKREC;

NAME: Defined Name (218h)

The NAME record describes a defined name in the workbook.

Record Data

Offset

Name

Size

Contents

4

grbit

2

Option flags

6

chKey

1

Keyboard shortcut

7

cch

1

Length of the name text

8

cce

2

Length of the name definition

10

ixals

2

Index to the sheet that contains this name, if the name is a local name (see text)

12

itab

2

This field is equal to ixals

14

cchCustMenu

1

Length of the custom menu text

15

cchDescription

1

Length of the description text

16

cchHelptopic

1

Length of the help topic text

17

cchStatustext

1

Length of the status bar text

18

rgch

var

Name text

var

rgce

var

Name definition (see text)

var

rgchCustMenu

var

Custom menu text

var

rgchDescr

var

Description text

var

rgchHelptopic

var

Help topic text

var

rgchStatustext

var

Status bar text


The grbit field contains the option flags listed in the following table.

Bits

Mask

Name

Contents

0

0001h

fHidden

= 1 if the name is hidden

1

0002h

fFunc

= 1 if the name is a function

2

0004h

fOB

= 1 if the name is a Visual Basic procedure

3

0008h

fProc

= 1 if the name is a function or command name on a macro sheet

4

0010h

fCalcExp

= 1 if the name contains a complex function

5

0020h

fBuiltin

= 1 if the name is a built-in name

11–6

0FC0h

fgrp

Function group index

12

1000h

fBig

= 1 if the name refers to binary data (see text)

15–13

C000h

(Reserved)


If the fBig bit in the grbit field is equal to 1, the NAME record contains a name attached to binary data. These names can be created only by calling the xlDefineBinaryName function from the Microsoft Excel C API. The first byte is the length of the name, which is followed by the name string. Following the name string is the data to which the name refers. The data can be up to 232 bytes long and can span multiple CONTINUE records.

The fCalcExp bit is set if the name definition contains a function that returns an array (for example, TREND, MINVERSE), contains a ROW or COLUMN function, or contains a user-defined function.

The chKey byte is significant only when the fProc bit is set in the grbit field. chKey is the keyboard shortcut for a command macro name. If the name is not a command macro name or has no keyboard shortcut, chKey is meaningless.

The cch field contains the length of the name text, and the rgch field contains the text itself. The cce field contains the length of the name definition, and the rgce field contains the definition itself. The location of rgce within the record depends on the length of the name text (rgch) field.

The name definition (rgce) is stored in the Microsoft Excel parsed format. For more information, see Microsoft Excel Formulas.

The NAME record stores two types of names: global names and local names. A global name is defined for an entire workbook, and a local name is defined on a single sheet. For example, MyName is a global name, whereas Sheet1!MyName is a local name. The ixals field in the NAME record will be nonzero for local names and will index the list of EXTERNSHEET records for the sheets in the workbook. The following field, itab, is equal to ixals.

All NAME records should appear together in a BIFF file. The order of NAME records in an existing BIFF file should not be changed. You can add new names to a file, but you should add them at the end of the NAME list (block of NAME records). Microsoft Excel saves the names to the BIFF file in alphabetic order, but this is not a requirement; Microsoft Excel will sort the name list, if necessary, when it loads a BIFF file.

Built-in Names

Microsoft Excel contains several built-in names — such as Criteria, Database, Auto_Open, and so on — for which the NAME records do not contain the actual name. Instead, cch always equals 1, and a single byte is used to identify the name as shown in the following table.

Built-in name

rgch

Consolidate_Area

00

Auto_Open

01

Auto_Close

02

Extract

03

Database

04

Criteria

05

Print_Area

06

Print_Titles

07

Recorder

08

Data_Form

09

Auto_Activate

0A

Auto_Deactivate

0B

Sheet_Title

0C


NOTE: Note Associated with a Cell (1Ch)

The NOTE record specifies a note associated with a particular cell.

Record Data

Offset

Name

Size

Contents

4

rw

2

Row of the note

6

col

2

Column of the note

8

cch

2

Length of the note (bytes)

10

rgch

var

Text of the note


The cell is denoted by the rw and col fields. The rw field contains the 0-based row number. The col field contains the 0-based column number.

The cch field contains the length of the note in bytes. The rgch field contains the text of the note in ASCII format.

Notes longer than 2048 characters (bytes) must be divided into several NOTE records, with each record containing no more than 2048 characters. In this case, the first NOTE record contains the fields listed in the following table.

Offset

Name

Size

Contents

4

rw

2

Row of the note

6

col

2

Column of the note

8

cch

2

Total length of the note

10

rgch

2048

First 2048 characters of the note


Each successive NOTE record contains the fields listed in the following table.

Offset

Name

Size

Contents

4

rw

2

= –1 always (FFFFh)

6

(Reserved)

2

Reserved; must be 0 (zero)

8

cch

2

Length of this section of the note

10

rgch

var

This section of the note


NUMBER: Cell Value, Floating-Point Number (203h)

A NUMBER record describes a cell containing a constant floating-point number. The rw field contains the 0-based row number. The col field contains the 0-based column number. The number is contained in the num field in 8-byte IEEE floating-point format.

Record Data

Offset

Name

Size

Contents

4

rw

2

Row

6

col

2

Column

8

ixfe

2

Index to the XF record

10

num

8

Floating-point number value


OBJ: Describes a Graphic Object (5Dh)

BIFF files may contain several different variations of the OBJ record. They correspond to the graphic objects and dialog box controls available in Microsoft Excel: line object, rectangle object, check box object, and so on.

Record Data

The first 36 bytes of every OBJ record are fields that are common to all object types. The remaining fields are object-specific and are described in separate sections following the common object fields.

Common Object Fields

Offset

Name

Size

Contents

4

cObj

4

Count (1-based) of the objects in the file

8

OT

2

Object type:
Group object: OT = 00h
Line object: OT = 01h
Rectangle object: OT = 02h
Oval object: OT = 03h
Arc object: OT = 04h
Chart object: OT = 05h
Text object: OT = 06h
Button object: OT = 07h
Picture object: OT = 08h
Polygon object: OT = 09h
Check box object: OT = 0Bh
Option button object: OT = 0Ch
Edit box object: OT = 0Dh
Label object: OT = 0Eh
Dialog frame object: OT = 0Fh
Spinner object: OT = 10h
Scroll bar object: OT = 11h
List box object: OT = 12h
Group box object: OT = 13h
Drop-down object: OT = 14h

10

id

2

Object identification number

12

grbit

2

Option flags (see the following table)

14

colL

2

Column containing the upper-left corner of the object's bounding rectangle

16

dxL

2

X (horizontal) position of the upper-left corner of the object's bounding rectangle, relative to the left side of the underlying cell, expressed as 1/1024th of the cell's width

18

rwT

2

Row containing the upper-left corner of the object's bounding rectangle

20

dyT

2

Y (vertical) position of the upper-left corner of the object's bounding rectangle, relative to the top of the underlying cell, expressed as 1/1024th of the cell's height

22

colR

2

Column containing the lower-right corner of the object's bounding rectangle.

24

dxR

2

X (horizontal) position of the lower-right corner of the object's bounding rectangle, relative to the left side of the underlying cell, expressed as 1/1024th of the cell's width.

26

rwB

2

Row containing the lower-right corner of the object's bounding rectangle.

28

dyB

2

Y (vertical) position of the lower-right corner of the object's bounding rectangle, relative to the top of the underlying cell, expressed as 1/1024th of the cell's height.

30

cbMacro

2

Length of the FMLA structure that stores the definition of the attached macro; see FMLA Structure. Some objects may store the length of the FMLA structure in a cbFmla that immediately preceded the FMLA; in these objects, cbMacro is ignored.

32

(Reserved)

6

Reserved; must be 0 (zero).


The grbit field at byte 12 contains the flag bits listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fSel

= 1 if the object is selected

1

02h

fAutoSize

= 1 if the object moves and sizes with the cells

2

04h

fMove

= 1 if the object moves with the cells (Format Object dialog box, Properties tab)

3

08h

(Reserved)

Reserved; must be 0 (zero)

4

10h

fLocked

= 1 if the object is locked when the sheet is protected

5

20h

(Reserved)

Reserved; must be 0 (zero)

6

40h

(Reserved)

Reserved; must be 0 (zero)

7

80h

fGrouped

= 1 if the object is part of a group of objects

1

0

01h

fHidden

= 1 if the object is hidden (this can only be done from a macro)

1

02h

fVisible

= 1 if the object is visible

2

04h

fPrint

= 1 if the object is printable

7-3

F8h

(Reserved)

Reserved; must be 0 (zero)


Line Object Fields

Offset

Name

Size

Contents

38

icv

1

Index to the color palette for line color.

39

lns

1

Line style:
Solid: lns = 0
Dash: lns = 1
Dot: lns = 2
Dash-dot: lns = 3
Dash-dot-dot: lns = 4
Null (unused): lns = 5
Dark gray: lns = 6
Medium gray: lns = 7
Light gray: lns = 8

40

lnw

1

Line weight:
Hairline: lnw = 0
Single: lnw = 1
Double: lnw = 2
Thick: lnw = 3

41

fAuto

1

Bit 0 = 1 if Automatic Border option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

42

es

2

End style structure (see the following table).

44

iqu

1

Quadrant index (direction of line):
Starts upper left, ends lower right: iqu = 0
Starts upper right, ends lower left: iqu = 1
Starts lower right, ends upper left: iqu = 2
Starts lower left, ends upper right: iqu = 3

45

(Reserved)

1

Reserved; must be 0 (zero).

46

cchName

1

Length of the name (null if no name).

47

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment).

var

fmla

var

FMLA structure (see the following section).


The end style structure (es) describes the arrowheads on the end point of the line. The structure contains four 4-bit fields, as described in the following table.

Offset

Bits

Mask

Name

Contents

0

3–0

0Fh

sest

Arrowhead style:
None: sest = 0
Open: sest = 1
Filled: sest = 2
Double-ended open: sest = 3
Double-ended filled: sest = 4

7–4

F0h

sesw

Arrowhead width:
Narrow: sesw = 0
Medium: sesw = 1
Wide: sesw = 2

1

3–0

0Fh

sesl

Arrowhead length:
Short: sesl = 0
Medium: sesl = 1
Long: sesl = 2

7–4

F0h

(Unused)


FMLA Structure

The FMLA structure stores a parsed expression for the macro that is attached to the object. For more information about parsed expressions, see Microsoft Excel Formulas. The FMLA structure is null if the object does not have a macro attached.

In some object types, the FMLA structure length is given by cbMacro in the common object fields. In other object types, the FMLA structure length is given by a cbFmla that immediately precedes the FMLA. In these object types, ignore cbMacro. There may be an optional padding byte at the end of the FMLA to force it to end on a word boundary. The FMLA structure has the form shown in the following table.

Offset

Name

Size

Contents

0

cce

2

Length of the parsed expression

2

(Reserved)

4

6

rgce

var

Parsed expression (may contain a padding byte to force word-boundary alignment)


Rectangle Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color

39

icvFore

1

Index to the color palette for foreground color

40

fls

1

Fill pattern

41

fAuto

1

Bit 0 = 1 if the Automatic Fill option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

42

icv

1

Index to the color palette for line color.

43

lns

1

Line style (see Line Object Fields).

44

lnw

1

Line weight (see Line Object Fields).

45

fAuto

1

Bit 0 = 1 if the Automatic border option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

46

frs

2

Frame style structure (see the following table).

48

cchName

1

Length of the name (null if no name).

49

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment).

var

fmla

var

FMLA structure (see FMLA Structure).


The frame style structure (frs) contains 16 bits. Because dxyCorner overlaps the byte boundary, the structure is defined as a single 16-bit field instead of two 8-bit fields.

Offset

Bits

Mask

Name

Contents

0

0

0001h

frt

= 1 if the rectangle has rounded corners
(Format Object dialog box, Patterns tab)

1

0002h

fShadow

= 1 if the rectangle has a shadow border
(Format Object dialog box, Patterns tab)

9-2

03FCh

dxyCorner

Diameter of the oval (actually a circle) that defines the rounded corners (if frt = 1)

15–10

FC00h

(Unused)


Oval Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color.

39

icvFore

1

Index to the color palette for foreground color.

40

fls

1

Fill pattern.

41

fAuto

1

Bit 0 = 1 if the Automatic Fill option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

42

icv

1

Index to the color palette for line color.

43

lns

1

Line style (see Line Object Fields).

44

lnw

1

Line weight (see Line Object Fields).

45

fAuto

1

Bit 0 = 1 if the Automatic Border option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

46

frs

2

Frame style structure (see the following table).

48

cchName

1

Length of the name (null if no name).

49

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment).

var

fmla

var

FMLA structure (see FMLA Structure).


The frame style structure (frs) contains 16 bits. dxyCorner is not used for oval objects.

Offset

Bits

Mask

Name

Contents

0

0

0001h

frt

(Not used for oval objects)

1

0002h

fShadow

= 1 if the oval has a shadow border (Format Object dialog box, Patterns tab)

2–9

03FCh

dxyCorner

(Not used for oval objects)

10–15

FC00h

(Unused)


Arc Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color.

39

icvFore

1

Index to the color palette for foreground color.

40

fls

1

Fill pattern.

41

fAuto

1

Bit 0 = 1 if the Automatic Fill option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

42

icv

1

Index to the color palette for line color.

43

lns

1

Line style (see Line Object Fields).

44

lnw

1

Line weight (see Line Object Fields).

45

fAuto

1

Bit 0 = 1 if the Automatic Border option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

46

iqu

1

Quadrant index (the section of an oval that describes the arc):
Upper-right quadrant of the oval: iqu = 0
Upper-left quadrant of the oval: iqu = 1
Lower-left quadrant of the oval: iqu = 2
Lower-right quadrant of the oval: iqu = 3

47

(Reserved)

1

Reserved; must be 0 (zero).

48

cchName

1

Length of the name (null if no name).

49

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment).

var

fmla

var

FMLA structure (see FMLA Structure).


Chart Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color.

39

icvFore

1

Index to the color palette for foreground color.

40

fls

1

Fill pattern.

41

fAuto

1

Bit 0 = 1 if the Automatic Fill option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

42

icv

1

Index to the color palette for line color.

43

lns

1

Line style (see Line Object Fields).

44

lnw

1

Line weight (see Line Object Fields).

45

fAuto

1

Bit 0 = 1 if the Automatic Border option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

46

frs

2

Frame style structure (see Rectangle Object Fields).

48

grbit

2

Option flags (shown LSB to MSB):
fLinked:1 = 1 if linked to a chart sheet
Reserved:15 Reserved; must be 0 (zero)

50

(Reserved)

16

Reserved; must be 0 (zero)

66

cchName

1

Length of the name (null if no name)

67

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment)

var

fmla

var

FMLA structure (see FMLA Structure)


An embedded chart BIFF substream immediately follows the chart object record. This embedded chart file begins with a BOF record and ends with an EOF record. For more information, see Microsoft Excel Chart Records.

Text Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color.

39

icvFore

1

Index to the color palette for foreground color.

40

fls

1

Fill pattern.

41

fAuto

1

Bit 0 = 1 if the Automatic Fill option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

42

icv

1

Index to the color palette for line color.

43

lns

1

Line style (see Line Object Fields).

44

lnw

1

Line weight (see Line Object Fields).

45

fAuto

1

Bit 0 = 1 if the Automatic Border option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

46

frs

2

Frame style structure (see the preceding section, "Rectangle Object Fields").

48

cbText

2

Length of the object text.

50

(Reserved)

2

Reserved; must be 0 (zero).

52

cbRuns

2

Total length of all TXORUNS structures in the record.

54

ifntEmpty

2

If cbRuns = 0, the text object is empty, and these 2 bytes contain the index to the FONT record for the object.

If the object contains text, cbRuns > 0, and these 2 bytes are reserved.

56

(Reserved)

2

Reserved; must be 0 (zero).

58

grbit

2

Option flags (see the following table).

60

rot

2

Orientation of text within the object boundary (Format Object dialog box, Alignment tab):
= 0, no rotation (text appears left to right)
= 1, text appears top to bottom; letters are upright
= 2, text is rotated 90 degrees counterclockwise
= 3, text is rotated 90 degrees clockwise

62

(Reserved)

12

Reserved; must be 0 (zero)

74

cchName

1

Length of the name (null if no name)

75

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment)

var

fmla

var

FMLA structure (see FMLA Structure)

var

rgch

var

Object text; may contain a single padding byte at the end of the text for word-boundary alignment (cbText does not count this padding byte)

var

TXORUNS

8

TXORUNS structure (see TXORUNS)

var

TXORUNS

8

TXORUNS structure (see TXORUNS)


The grbit field at byte 58 contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

(Reserved)

Reserved; must be 0 (zero)

3–1

0Eh

alcH

Horizontal text alignment:
= 001 left-aligned
= 010 centered
= 011 right-aligned
= 100 justified

6–4

70h

lcV

Vertical text alignment:
= 001 left-aligned
= 010 centered
= 011 right-aligned
= 100 justified

7

80h

fAutoTextSize

= 1 if the Automatic Size option is turned on (Format Object dialog box, Alignment tab)

1

0

01h

(Unused)

1

02h

fLockText

= 1 if the Lock Text option is turned on (Format Object dialog box, Protection tab)

2

04h

fFuzzy

= 1 if the object is selected (the broken border is displayed)

7-3

F8h

(Reserved)

Reserved; must be 0 (zero)


TXORUNS

The TXORUNS structure contains formatting information about the object text string. A TXORUNS structure occurs every time the text formatting changes. The TXORUNS structure is described in the following table.

Offset

Name

Size

Contents

0

ichFirst

2

Index to the first character to which the formatting applies

2

ifnt

2

Index to the FONT record

4

(Reserved)

4


There are always at least two TXORUNS structures in the text object record, even if the entire text string is normal font (ifnt = 0). The last TXORUNS structure, which ends the formatting information for the string, always has ichFirst = cbText, and ifnt = 0.

Button Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color (fixed for buttons).

39

icvFore

1

Index to the color palette for foreground color (fixed for buttons).

40

fls

1

Fill pattern (fixed for buttons).

41

grbit

1

Option flags (fixed for buttons).

42

icv

1

Index to the color palette for line color (fixed for buttons).

43

lns

1

Line style (fixed for buttons).

44

lnw

1

Line weight (fixed for buttons).

45

fAuto

1

Bit 0 = 1 (fixed for buttons).

46

frs

2

Frame style structure (ignored for buttons).

48

cbText

2

Length of the object text.

50

(Reserved)

2

Reserved; must be 0 (zero).

52

cbRuns

2

Total length of all TXORUNS structures in record

54

ifntEmpty

2

If cbRuns = 0, the button object is empty, and these 2 bytes contain the index to the FONT record for the object.

If the object contains text, cbRuns > 0, and these 2 bytes are reserved.

56

(Reserved)

2

Reserved; must be 0 (zero).

58

grbit

2

Option flags (see the following table).

60

rot

2

Orientation of text within the object boundary (Format Object dialog box, Alignment tab):
= 0, no rotation (text appears left to right)
= 1, text appears top to bottom; letters are upright
= 2, text is rotated 90 degrees counterclockwise
= 3, text is rotated 90 degrees clockwise

62

(Reserved)

6

Reserved; must be 0 (zero)

68

grbit

2

Option flags (shown LSB to MSB):
fDefault:1 = 1 if this is the default button
fHelp:1 = 1 if this is the Help button
fCancel:1 = 1 if this is the cancel button
fDismiss:1 = 1 if this is the dismiss button
Reserved:12 Reserved; must be 0 (zero)

70

accel

2

Accelerator key character

72

accel2

2

Accelerator key character (Far East versions only)

74

cchName

1

Length of the name (null if no name)

75

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment)

var

fmla

var

FMLA structure (see FMLA Structure)

var

rgch

var

Object text; may contain a single padding byte at the end of the text for word-boundary alignment (cbText does not count this padding byte)

var

TXORUNS

8

TXORUNS structure (see TXORUNS)

var

TXORUNS

8

TXORUNS structure (see TXORUNS)


The grbit field at byte 58 contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

(Reserved)

Reserved; must be 0 (zero)

3–1

0Eh

alcH

Horizontal text alignment:
= 001 left-aligned
= 010 centered
= 011 right-aligned
= 100 justified

6–4

70h

alcV

Vertical text alignment:
= 001 left-aligned
= 010 centered
= 011 right-aligned
= 100 justified

7

80h

fAutoTextSize

= 1 if the Automatic Size option is turned on (Format Object dialog box, Alignment tab)

1

0

01h

(Unused)

1

02h

fLockText

= 1 if the Lock Text option is turned on (Format Object dialog box, Protection tab)

2

04h

fFuzzy

= 1 if the object is selected (the broken border is displayed)

7-3

F8h

(Reserved)

Reserved; must be 0 (zero)


Picture Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color.

39

icvFore

1

Index to the color palette for foreground color.

40

fls

1

Fill pattern.

41

fAuto

1

Bit 0 = 1 if the Automatic Fill option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

42

icv

1

Index to the color palette for line color.

43

lns

1

Line style (see Line Object Fields).

44

lnw

1

Line weight (see Line Object Fields).

45

fAuto

1

Bit 0 = 1 if the Automatic Border option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

46

frs

2

Frame style structure (see the preceding section, "Rectangle Object Fields").

48

cf

2

Image format:
= 00h Text format
= 01h Null format (no image data)
= 02h Windows metafile or Macintosh PICT
format
= 09h Windows bitmap format

50

(Reserved)

4

Reserved; must be 0 (zero)

54

cbPictFmla

2

Length of the picture FMLA structure (the FMLA that contains the link to the picture)

56

(Reserved)

2

Reserved; must be 0 (zero)

58

grbit

2

Option flags (see the following table)

60

(Reserved)

4

Reserved; must be 0 (zero)

64

cchName

1

Length of the name (null if no name)

65

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment)

var

fmla

var

Attached macro FMLA structure (see FMLA Structure)

var

PictFmla

var

Picture FMLA structure (see FMLA Structure)

var

(Reserved)

4

Reserved; must be 0 (zero)


The grbit field at byte 58 contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fAutoPict

= 0 if the user manually sizes picture by dragging a handle

1

02h

fDde

= 1 if the reference in the FMLA structure is a DDE reference

2

04h

fIcon

= 1 if the picture is from a DDE link, and the only available representation of the picture is an icon

7–3

F8h

(Unused)

1

7–0

FFh

(Unused)


Sheet Background in Microsoft Excel for Windows 95

The sheet background bitmap for worksheets and charts is stored as a hidden picture object that has the name__BkgndObj (the stName field at byte 65). An IMDATA record will also appear in the file to store the image description.

Group Object Fields

Offset

Name

Size

Contents

34

(Reserved)

4

Reserved; must be 0 (zero).

38

idNext

2

Object ID number (id) of the object that follows the last object in this group. If there are no objects following the group, idNext = 0.

40

(Reserved)

16

Reserved; must be 0 (zero).


A Group OBJ record precedes the OBJ records for the group members.

Polygon Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color.

39

icvFore

1

Index to the color palette for foreground color.

40

fls

1

Fill pattern.

41

fAuto

1

Bit 0 = 1 if the Automatic Fill option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

42

icv

1

Index to the color palette for line color.

43

lns

1

Line style (see the preceding section, "Line Object Fields").

44

lnw

1

Line weight (see preceding section, "Line Object Fields")

45

fAuto

1

Bit 0 = 1 if the Automatic Border option is turned on (Format Object dialog box, Patterns tab). All other bits in fAuto are don't-care.

46

frs

2

Frame style structure (see the preceding section, "Rectangle Object Fields").

48

wstate

2

If bit 0 = 1, the polygon is closed. All other bits are don't-care.

50

(Reserved)

10

60

iMacSav

2

Number of vertices in the polygon (1-based).

62

(Reserved)

8

70

cchName

1

Length of the name (null if no name).

71

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment).

var

fmla

var

FMLA structure (see FMLA Structure).


For polygon objects, a COORDLIST record follows the OBJ record.

Check Box Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color (fixed for check box objects)

39

icvFore

1

Index to the color palette for foreground color (fixed for check box objects)

40

fls

1

Fill pattern (ignored for check box objects)

41

fAuto

1

(Ignored for check box objects)

42

icv

1

Index to the color palette for line color (fixed for check box objects)

43

lns

1

Line style (ignored for check box objects)

44

lnw

1

Line weight (ignored for check box objects)

45

fAuto

1

(Ignored for check box objects)

46

frs

2

Frame style structure (ignored for check box objects)

48

(Reserved)

10

Reserved; must be 0 (zero)

58

grbit

2

Option flags (see the following table)

60

(Reserved)

20

Reserved; must be 0 (zero)

80

cchName

1

Length of the name (null if no name)

81

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment)

var

cbFmla1

2

Length of the FMLA structure for the attached macro (never null)

var

fmla1

var

FMLA structure for the attached macro (see FMLA Structure)

var

cbFmla2

2

Length of the FMLA structure for the cell link (never null)

var

fmla2

var

FMLA structure for the cell link (see FMLA Structure)

var

cbText

2

Length of the object text (never null)

var

rgch

var

Object text; may contain a single padding byte at the end of the text for word-boundary alignment (cbText does not count this padding byte)

var

fChecked

2

= 0 if the check box is not checked
= 1 the if check box is checked
= 2 if the check box is gray (mixed)

var

accel

2

Accelerator key character

var

accel2

2

Accelerator key character (Far East versions only)

var

grbit

2

Option flags (shown LSB to MSB):
fNo3d:1 = 1 if 3-D shading is turned off
fBoxOnly:1 = 1 if only the box is drawn
Reserved:14 Reserved; must be 0 (zero)


The grbit field at byte 58 contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

7-0

FFh

(Reserved)

Reserved; must be 0 (zero)

1

0

01h

(Unused)

1

02h

fLockText

= 1 if the Lock Text option is turned on (Format Object dialog box, Protection tab)

2

04h

fFuzzy

= 1 if the object is selected (the broken border is displayed)

7-3

F8h

(Reserved)

Reserved; must be 0 (zero)


Dialog Frame Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color (fixed for dialog frame objects)

39

icvFore

1

Index to the color palette for foreground color (fixed for dialog frame objects)

40

fls

1

Fill pattern (ignored for dialog frame objects)

41

grbit

1

Option flags (ignored for dialog frame objects)

42

icv

1

Index to the color palette for line color (fixed for dialog frame objects)

43

lns

1

Line style (ignored for dialog frame objects)

44

lnw

1

Line weight (ignored for dialog frame objects)

45

fAuto

1

Bit 0 = 1 for dialog frame objects

46

frs

2

Frame style structure (ignored for dialog frame objects)

48

cbText

2

Length of the object text

50

(Reserved)

8

Reserved; must be 0 (zero)

58

grbit

2

Option flags (see the following table)

60

(Reserved)

14

Reserved; must be 0 (zero)

74

cchName

1

Length of the name (null if no name)

75

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment)

var

fmla

var

FMLA structure (see FMLA Structure)

var

rgch

var

Object text; may contain a single padding byte at the end of the text for word-boundary alignment (cbText does not count this padding byte)

var

TXORUNS

8

TXORUNS structure (see text)

var

TXORUNS

8

TXORUNS structure (see text)


The grbit field at byte 58 contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

7-0

FFh

(Reserved)

Reserved; must be 0 (zero)

1

0

01h

(Unused)

1

02h

fLockText

= 1 if the Lock Text option is turned on (Format Object dialog box, Protection tab)

2

04h

fFuzzy

= 1 if an object is selected (the broken border is displayed)

7-3

F8h

(Reserved)

Reserved; must be 0 (zero)


The TXORUNS structure contains formatting information about the object text string, which is the dialog box caption. There are two TXORUNS structures in the dialog frame object record. The first has ichFirst = 00h, and it has ifnt pointing to the FONT record for the text. The second has ichFirst = cbText, and it contains no other useful information. The TXORUNS structure is shown in the following table.

Offset

Name

Size

Contents

0

ichFirst

2

Index to the first character to which the formatting applies

2

ifnt

2

Index to the FONT record

4

(Reserved)

4


Drop-Down Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color (fixed for drop-down objects)

39

icvFore

1

Index to the color palette for foreground color (fixed for drop-down objects)

40

fls

1

Fill pattern (ignored for drop-down objects)

41

grbit

1

Option flags (ignored for drop-down objects)

42

icv

1

Index to the color palette for line color (fixed for drop-down objects)

43

lns

1

Line style (ignored for drop-down objects)

44

lnw

1

Line weight (ignored for drop-down objects)

45

fAuto

1

Bit 0 = 1 for drop-down objects

46

frs

2

Frame style structure (ignored for drop-down objects)

48

(Reserved)

4

Reserved; must be 0 (zero)

52

iVal

2

Scroll bar position

54

iMin

2

Scroll bar minimum value

56

iMax

2

Scroll bar maximum value

58

dInc

2

Amount to scroll when an arrow is clicked

60

dPage

2

Amount to scroll when the scroll bar is clicked

62

fHoriz

2

= 1 if the scroll bar is horizontal

64

dxScroll

2

Width of the scroll bar

66

grbit

2

Option flags (shown LSB to MSB):
(Reserved):3 Reserved; must be 0 (zero)
fNo3d:1 = 1 if 3-D shading is turned off
(Reserved):12 Reserved; must be 0 (zero)

68

(Reserved)

18

Reserved; must be 0 (zero)

86

ifnt

2

Index to the FONT record for list box

88

(Reserved)

14

Reserved; must be 0 (zero)

102

xLeft

2

X (horizontal) position of the upper-left corner of the drop-down object's bounding rectangle

104

yTop

2

Y (vertical) position of the upper-left corner of the drop-down object's bounding rectangle

106

xRight

2

X (horizontal) position of the lower-right corner of the drop-down object's bounding rectangle

108

yBot

2

Y (vertical) position of the lower-right corner of the drop-down object's bounding rectangle

110

(Reserved)

4

Reserved; must be 0 (zero)

114

cchName

1

Length of the name (null if no name)

115

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment)

var

cbFmla1

2

Length of the FMLA structure for the attached macro (never null)

var

fmla1

var

FMLA structure for the attached macro (see FMLA Structure)

var

cbFmla2

2

Length of the FMLA structure for the cell link (never null)

var

fmla2

var

FMLA structure for the cell link (see FMLA Structure)

var

cbFmla3

2

Length of the FMLA structure for the input range (never null)

var

fmla3

var

FMLA structure for the input range (see FMLA Structure)

var

cLines

2

Number of elements in the list box (1-based)

var

iSel

2

Index of the selected item (1-based)

var

grbit

2

Option flags (shown LSB to MSB):
f(reserved):2 Reserved; must be 0 (zero)
fValidIds:1 = 1 if idEdit is valid
fNo3d:1 = 1 if 3-D shading is turned off
(Reserved):12 Reserved; must be 0 (zero)

var

(Reserved)

2

Reserved; must be 0 (zero)

var

grbit

2

Option flags (shown LSB to MSB):
wStyle:2 Drop-down style:
0 = combo,
1 = combo edit,
2 = simple
3 = max
(Reserved):14 Reserved; must be 0 (zero)

var

cLine

2

Maximum number of lines that the drop-down list box contains before a scroll bar is added

var

dxMin

2

Minimum allowable width of the drop-down list box

var

(Reserved)

2

Reserved; must be 0 (zero)


Edit Box Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color (fixed for edit box objects)

39

icvFore

1

Index to the color palette for foreground color (fixed for edit box objects)

40

fls

1

Fill pattern (ignored for edit box objects)

41

grbit

1

Option flags (ignored for edit box objects)

42

icv

1

Index to the color palette for line color (fixed for edit box objects)

43

lns

1

Line style (ignored for edit box objects)

44

lnw

1

Line weight (ignored for edit box objects)

45

fAuto

1

Bit 0 = 1 for edit box objects

46

frs

2

Frame style structure (ignored for edit box objects)

48

(Reserved)

10

Reserved; must be 0 (zero)

58

grbit

2

Option flags (see the following table)

60

(Reserved)

14

Reserved; must be 0 (zero)

74

cchName

1

Length of the name (null if no name)

75

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment)

var

cbFmla

2

Length of the FMLA structure for the attached macro (never null)

var

fmla

var

FMLA structure for the attached macro (see FMLA Structure)

var

cbText

2

Length of the object text (never null)

var

rgch

var

Object text; may contain a single padding byte at the end of the text for word-boundary alignment (cbText does not count this padding byte)

var

ivtEdit

2

Edit validation:
= 000, Text
= 001, Integer
= 010, Number
= 011, Reference
= 100, Formula

var

fMultiLine

2

= 1 if the edit is a multiline edit

var

fVScroll

2

= 1 if the edit box has a vertical scroll bar

var

idList

2

Object ID of the linked list box or linked drop-down, if the edit box is part of a combination list-edit box or combination drop-down edit box. If idList = 0, this is a simple edit box.


The grbit field at byte 58 contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

7-0

FFh

(Reserved)

Reserved; must be 0 (zero)

1

0

01h

(Unused)

1

02h

fLockText

= 1 if the Lock Text option is turned on (Format Object dialog box, Protection tab)

2

04h

fFuzzy

= 1 if the object is selected (the broken border is displayed)

7-3

F8h

(Reserved)

Reserved; must be 0 (zero)


Group Box Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color (fixed for group box objects).

39

icvFore

1

Index to the color palette for foreground color (fixed for group box objects).

40

fls

1

Fill pattern (ignored for group box objects).

41

grbit

1

Option flags (ignored for group box objects).

42

icv

1

Index to the color palette for line color (fixed for group box objects).

43

lns

1

Line style (ignored for group box objects).

44

lnw

1

Line weight (ignored for group box objects).

45

fAuto

1

Bit 0 = 1 for group box objects.

46

frs

2

Frame style structure (ignored for group box objects).

48

(reserved)

10

Reserved; must be 0 (zero).

58

grbit

2

Option flags (see the following table).

60

(reserved)

26

Reserved; must be 0 (zero).

86

cchName

1

Length of the name (null if no name).

87

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment).

var

cbFmla

2

Length of the FMLA structure (never null).

var

fmla

var

FMLA structure (see FMLA Structure).

var

cbText

2

Length of object text (never null)

var

rgch

var

Object text; may contain a single padding byte at the end of the text for word-boundary alignment (cbText does not count this padding byte).

var

accel

2

Accelerator key character.

var

accel2

2

Accelerator key character (Far East versions only).

var

grbit

2

Option flags (shown LSB to MSB):
fNo3d:1 = 1 if 3-D shading is off
(Reserved):15 Reserved; must be 0 (zero)


The grbit field at byte 58 contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

7-0

FFh

(Reserved)

Reserved; must be 0 (zero)

1

0

01h

(Unused)

1

02h

fLockText

= 1 if the Lock Text option is on (Format Object dialog box, Protection tab)

2

04h

fFuzzy

= 1 if the object is selected (the broken border is displayed)

7-3

F8h

(Reserved)

Reserved; must be 0 (zero)


Label Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color (fixed for label objects).

39

icvFore

1

Index to the color palette for foreground color (fixed for label objects).

40

fls

1

Fill pattern (ignored for label objects).

41

grbit

1

Option flags (ignored for label objects).

42

icv

1

Index to the color palette for line color (fixed for label objects).

43

lns

1

Line style (ignored for label objects).

44

lnw

1

Line weight (ignored for label objects).

45

fAuto

1

Bit 0 = 1 for label objects.

46

frs

2

Frame style structure (ignored for label objects).

48

cbText

2

Length of object text.

50

(Reserved)

8

Reserved; must be 0 (zero).

58

grbit

2

Option flags (see the following table).

60

(Reserved)

14

Reserved; must be 0 (zero).

74

cchName

1

Length of the name (null if no name).

75

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment).

var

fmla

var

FMLA structure (see FMLA Structure).

var

rgch

var

Object text; may contain a single padding byte at the end of the text for word-boundary alignment (cbText does not count this padding byte).

var

TXORUNS

8

TXORUNS structure (see text).

var

TXORUNS

8

TXORUNS structure (see text)


The grbit field at byte 58 contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

7-0

FFh

(Reserved)

Reserved; must be 0 (zero)

1

0

01h

(Unused)

1

02h

fLockText

= 1 if the Lock Text option is on (Format Object dialog box, Protection tab)

2

04h

fFuzzy

= 1 if object is selected (the broken border is displayed)

7-3

F8h

(Reserved)

Reserved; must be 0 (zero)


The TXORUNS structure contains formatting information about the object text string, which is the label string. There are two TXORUNS structures in the label object record. The first has ichFirst = 00h and has ifnt pointing to the FONT record for the label. The second has ichFirst = cbText and contains no other useful information. The TXORUNS structure is shown in the following table.

Offset

Name

Size

Contents

0

ichFirst

2

Index to the first character to which the formatting applies

2

ifnt

2

Index to the FONT record

4

(Reserved)

4


List Box Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color (fixed for list box objects).

39

icvFore

1

Index to the color palette for foreground color (fixed for list box objects).

40

fls

1

Fill pattern (ignored for list box objects).

41

grbit

1

Option flags (ignored for list box objects).

42

icv

1

Index to the color palette for line color (fixed for list box objects).

43

lns

1

Line style (ignored for list box objects).

44

lnw

1

Line weight (ignored for list box objects).

45

fAuto

1

Bit 0 = 1 for list box objects.

46

frs

2

Frame style structure (ignored for list box objects).

48

(Reserved)

4

Reserved; must be 0 (zero).

52

iVal

2

Scroll bar position.

54

iMin

2

Scroll bar minimum value.

56

iMax

2

Scroll bar maximum value.

58

dInc

2

Amount to scroll when the arrow is clicked.

60

dPage

2

Amount to scroll when the scroll bar is clicked.

62

fHoriz

2

= 1 if the scroll bar is horizontal.

64

dxScroll

2

Width of the scroll bar.

66

grbit

2

Option flags (shown LSB to MSB):
(Reserved):3 Reserved; must be 0 (zero).
fNo3d:1 = 1 if 3-D shading is off.
(Reserved):12 Reserved; must be 0 (zero).

68

(Reserved)

18

Reserved; must be 0 (zero).

86

ifnt

2

Index to the FONT record for the list box.

88

(Reserved)

4

Reserved; must be 0 (zero).

92

cchName

1

Length of the name (null if no name).

93

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment).

var

cbFmla1

2

Length of the FMLA structure for the attached macro (never null).

var

fmla1

var

FMLA structure for the attached macro (see FMLA Structure).

var

cbFmla2

2

Length of the FMLA structure for the cell link (never null).

var

fmla2

var

FMLA structure for cell link (see FMLA Structure).

var

cbFmla3

2

Length of the FMLA structure for input range (never null).

var

fmla3

var

FMLA structure for input range (see FMLA Structure).

var

cLines

2

Number of elements in the list box (1-based).

var

iSel

2

Index of the selected item (1-based).

var

grbit

2

Option flags (shown LSB to MSB):
f(reserved):2 Reserved; must be 0 (zero).
fValidIds:1 = 1 if idEdit is valid.
fNo3d:1 = 1 if 3-D shading is off.
wListSelType:2 List box selection type:
0 = standard.
1 = multi-select.
2 = extended-select
(Reserved):10 Reserved; must be 0 (zero).

var

idEdit

2

Object ID of the linked edit box, if the list box is part of a combination list-edit box. If idList = 0, this is a simple list box.

var

rgbSel

var

Array of bytes, indicating which items are selected in a multi-select or extended-select list box. The number of elements in the array is equal to cLines. If an item is selected in the list box, the corresponding element in the array = 1.


Option Button Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color (fixed for option button objects).

39

icvFore

1

Index to the color palette for foreground color (fixed for option button objects).

40

fls

1

Fill pattern (ignored for option button objects).

41

fAuto

1

(Ignored for option button objects).

42

icv

1

Index to the color palette for line color (fixed for option button objects).

43

lns

1

Line style (ignored for option button objects).

44

lnw

1

Line weight (ignored for option button objects).

45

fAuto

1

(Ignored for option button objects).

46

frs

2

Frame style structure (ignored for option button objects).

48

(Reserved)

10

Reserved; must be 0 (zero).

58

grbit

2

Option flags (see the following table).

60

(Reserved)

32

Reserved; must be 0 (zero).

92

cchName

1

Length of the name (null if no name).

93

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment).

var

cbFmla1

2

Length of the FMLA structure for the attached macro (never null).

var

fmla1

var

FMLA structure for the attached macro (see FMLA Structure).

var

cbFmla2

2

Length of FMLA structure for the cell link (never null).

var

fmla2

var

FMLA structure for the cell link (see FMLA Structure).

var

cbText

2

Length of the object text (never null).

var

rgch

var

Object text; may contain a single padding byte at the end of the text for word-boundary alignment (cbText does not count this padding byte).

var

fChecked

2

= 0 if the option button is not checked.
= 1 if the option button is checked.

var

accel

2

Accelerator key character.

var

accel2

2

Accelerator key character (Far East versions only).

var

grbit

2

Option flags (shown LSB to MSB):
fNo3d:1 = 1 if 3-D shading is off.
fBoxOnly:1 = 1 if only the box is drawn.
Reserved:14 Reserved; must be 0 (zero).

var

idRadNext

2

Object ID of the next option button in the group.

var

fFirstBtn

2

= 1 if this option button is the first in the group.


The grbit field at byte 58 contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

7-0

FFh

(Reserved)

Reserved; must be 0 (zero)

1

0

01h

(Unused)

1

02h

fLockText

= 1 if the Lock Text option is on (Format Object dialog box, Protection tab).

2

04h

fFuzzy

= 1 if the object is selected (the broken border is displayed).

7-3

F8h

(Reserved)

Reserved; must be 0 (zero).


Scroll Bar Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color (fixed for scroll bar objects).

39

icvFore

1

Index to the color palette for foreground color (fixed for scroll bar objects).

40

fls

1

Fill pattern (ignored for scroll bar objects).

41

grbit

1

Option flags (ignored for scroll bar objects).

42

icv

1

Index to the color palette for line color (fixed for scroll bar objects).

43

lns

1

Line style (ignored for scroll bar objects).

44

lnw

1

Line weight (ignored for scroll bar objects).

45

fAuto

1

Bit 0 = 1 for scroll bar objects.

46

frs

2

Frame style structure (ignored for scroll bar objects).

48

(Reserved)

4

Reserved; must be 0 (zero).

52

iVal

2

Scroll bar position.

54

iMin

2

Scroll bar minimum value.

56

iMax

2

Scroll bar maximum value.

58

dInc

2

Amount to scroll when the arrow is clicked.

60

dPage

2

Amount to scroll when the scroll bar is clicked.

62

fHoriz

2

= 1 if the scroll bar is horizontal.

64

dxScroll

2

Width of the scroll bar.

66

grbit

2

Option flags (shown LSB to MSB):
(Reserved):3 Reserved; must be 0 (zero).
fNo3d:1 = 1 if 3-D shading is off.
(Reserved):12 Reserved; must be 0 (zero).

68

cchName

1

Length of the name (null if no name).

69

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment).

var

cbFmla1

2

Length of the FMLA structure for the attached macro (never null).

var

fmla1

var

FMLA structure for the attached macro (see FMLA Structure).

var

cbFmla2

2

Length of the FMLA structure for the cell link (never null).

var

fmla2

var

FMLA structure for the cell link (see FMLA Structure).


Spinner Object Fields

Offset

Name

Size

Contents

38

icvBack

1

Index to the color palette for background color (fixed for spinner objects).

39

icvFore

1

Index to the color palette for foreground color (fixed for spinner objects).

40

fls

1

Fill pattern (ignored for spinner objects).

41

grbit

1

Option flags (ignored for spinner objects).

42

icv

1

Index to the color palette for line color (fixed for spinner objects).

43

lns

1

Line style (ignored for spinner objects).

44

lnw

1

Line weight (ignored for spinner objects).

45

fAuto

1

Bit 0 = 1 for spinner objects.

46

frs

2

Frame style structure (ignored for spinner objects).

48

(Reserved)

4

Reserved; must be 0 (zero).

52

iVal

2

Spinner position.

54

iMin

2

Spinner minimum value.

56

iMax

2

Spinner maximum value.

58

dInc

2

Amount to scroll when the spinner is clicked.

60

(Reserved)

2

Reserved; must be 0 (zero).

62

fHoriz

2

= 1 if the spinner is horizontal.

64

dxScroll

2

Width of the spinner.

66

grbit

2

Option flags (shown LSB to MSB):
(Reserved):3 Reserved; must be 0 (zero).
fNo3d:1 = 1 if 3-D shading is off.
(Reserved):12 Reserved; must be 0 (zero).

68

cchName

1

Length of the name (null if no name).

69

stName

var

Name (null if no name; may contain a padding byte to force word-boundary alignment).

var

cbFmla1

2

Length of the FMLA structure for the attached macro (never null).

var

fmla1

var

FMLA structure for the attached macro (see FMLA Structure).

var

cbFmla2

2

Length of the FMLA structure for the cell link (never null).

var

fmla2

var

FMLA structure for the cell link (see FMLA Structure).


OBJPROTECT: Objects Are Protected (63h)

The OBJPROTECT record stores an option from the Protection command.

Record Data

Offset

Name

Size

Contents

4

fLockObj

2

= 1 if objects are protected


OBPROJ: Visual Basic Project (D3h)

The contents of this record are reserved.

Record Data

Offset

Name

Size

Contents

4

(Reserved)

var


OLESIZE: Size of OLE Object (DEh)

This record stores the size of an embedded OLE object (when Microsoft Excel is a server).

Record Data

Offset

Name

Size

Contents

4

(Reserved)

2

6

rwFirst

2

First row

8

rwLast

2

Last row

10

colFirst

1

First column

11

colLast

1

Last column


PALETTE: Color Palette Definition (92h)

The PALETTE record describes the colors selected in the Options dialog box, Color tab. Each rgch field contains 4 bytes: rgbRed, rgbGreen, rgbBlue, and an unused byte. The 3 color bytes correspond to the Red, Green, and Blue values in the Color Picker dialog box, and the unused byte is don't-care. The Color Picker dialog box appears when you click the Modify button on the Color tab. If the worksheet uses the default palette, the BIFF file does not contain the PALETTE record.

Record Data

Offset

Name

Size

Contents

4

ccv

2

Count of color values that follow

6

rgch

4

Color value of the first color in the palette

10

rgch

4

Color value of the second color in the palette

14

rgch

4

Color value of the third color in the palette

...

...

...

...

var

rgch

4

Color value of the last color (= ccv) in the palette


PANE: Number of Panes and Their Position (41h)

The PANE record describes the number and position of unfrozen panes in a window.

Record Data

Offset

Name

Size

Contents

4

x

2

Horizontal position of the split; 0 (zero) if none

6

y

2

Vertical position of the split; 0 (zero) if none

8

rwTop

2

Top row visible in the bottom pane

10

colLeft

2

Leftmost column visible in the right pane

12

pnnAct

2

Pane number of the active pane


The x and y fields contain the position of the vertical and horizontal splits, respectively, in units of 1/20 of a point. Either of these fields can be 0 (zero), indicating that the window is not split in the corresponding direction.

For a window with a horizontal split, the rwTop field is the topmost row visible in the bottom pane or panes. For a window with a vertical split, the colLeft field contains the leftmost column visible in the right pane or panes.

The pnnAct field indicates which pane is the active pane. The pnnAct field contains one of the following values:

0 = lower-right
1 = upper-right
2 = lower-left
3 = upper-left

If the window has frozen panes, as specified in the WINDOW2 record, x and y have special meaning. If there is a vertical split, x contains the number of columns visible in the top pane. If there is a horizontal split, y contains the number of rows visible in the left pane. Both types of splits can be present in a window, as in unfrozen panes.

PASSWORD: Protection Password (13h)

The PASSWORD record contains the encrypted password for a protected sheet or workbook. Note that this record specifies a sheet-level or workbook-level protection password, as opposed to the FILEPASS record, which specifies a file password.

Record Data

Offset

Name

Size

Contents

4

wPassword

2

Encrypted password


PLS: Environment-Specific Print Record (4Dh)

The PLS record saves printer settings and printer driver information.

Record Data, Macintosh

Offset

Name

Size

Contents

4

wEnv

2

Operating environment:
0 = Microsoft Windows.
1 = Apple Macintosh.

6

rgb

var

TPrint structure (for more information about this structure, see Inside Macintosh, Volume II, page 149).


Record Data, Windows

Offset

Name

Size

Contents

4

wEnv

2

Operating environment:
0 = Microsoft Windows.
1 = Apple Macintosh.

6

rgb

var

DEVMODE structure (for more information about this structure, see the documentation for the Microsoft Windows Software Development Kit).


PRECISION: Precision (0Eh)

The PRECISION record stores the Precision As Displayed option from the Options dialog box, Calculation tab.

Record Data

Offset

Name

Size

Contents

4

fFullPrec

2

= 0 if Precision As Displayed option is selected


PRINTGRIDLINES: Print Gridlines Flag (2Bh)

This record stores the Gridlines option from the Page Setup dialog box, Sheet tab.

Record Data

Offset

Name

Size

Contents

4

fPrintGrid

2

= 1 to print gridlines


PRINTHEADERS: Print Row/Column Labels (2Ah)

The PRINT HEADERS record stores the Row And Column Headings option from the Page Setup dialog box, Sheet tab.

Record Data

Offset

Name

Size

Contents

4

fPrintRwCol

2

= 1 to print row and column headings


PROTECT: Protection Flag (12h)

The PROTECT record stores the protection state for a sheet or workbook.

Record Data

Offset

Name

Size

Contents

4

fLock

2

= 1 if the sheet or workbook is protected


PUB: Publisher (89h)

The PUB record contains information about the publisher/subscriber feature. This record can be created only by Microsoft Excel for the Macintosh. However, if Microsoft Excel for any other operating environment encounters the PUB record in a BIFF file, it leaves the record in the file, unchanged, when the file is saved.

Record Data

Offset

Name

Size

Contents

4

grbit

2

Option flags

6

ref

6

Reference structure describing the published area on the worksheet

12

sec

36

Section record associated with the published area

48

rgbAlias

var

Contents of the alias pointed to by the section record


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fAprPrinted

= 1 if the published appearance is shown when printed

1

02h

fSizPrinted

= 1 if the published size is shown when printed

7–2

FCh

(Unused)

1

7–0

FFh

(Unused)


RECIPNAME: Recipient Name (B9h)

This record stores recipient information about a routing slip. The rgch field contains the concatenation of two null-terminated strings: Recipient's Friendly Name, and Recipient's System-Specific Address.

Record Data

Offset

Name

Size

Contents

4

cchRecip

2

Length of the recipient's friendly name string

6

ulEIDSize

4

Length of the recipient's system-specific address string

10

rgchRecip

var

(See the text)


REFMODE: Reference Mode (0Fh)

The REFMODE record stores the Reference Style option from the Options dialog box, General tab.

Record Data

Offset

Name

Size

Contents

4

fRefA1

2

Reference mode:
= 1 for A1 mode
= 0 for R1C1 mode


RIGHTMARGIN: Right Margin Measurement (27h)

The RIGHT MARGIN record specifies the right margin in inches. The num field is in 8-byte IEEE floating-point format.

Record Data

Offset

Name

Size

Contents

4

num

8

Right margin


RK: Cell Value, RK Number (7Eh)

Microsoft Excel uses an internal number type, called an RK number, to save memory and disk space.

Record Data

Offset

Name

Size

Contents

4

rw

2

Row number

6

col

2

Column number

8

ixfe

2

Index to the XF record that contains the cell format

10

rk

4

RK number (see the following description)


An RK number is either a 30-bit integer or the most significant 30 bits of an IEEE number. The two LSBs of the 32-bit rk field are always reserved for RK type encoding; this is why the RK numbers are 30 bits, not the full 32. See the following diagram.

There are four different RK number types, as described in the following table.


RK type

Encode priority

Number (decimal)

RK number (hex)

Description of 30-bit
encoding

0

1

1

3F F0 00 00

IEEE number

1

3

1.23

40 5E C0 01

IEEE number x 100

2

2

12345678

02 F1 85 3A

Integer

3

4

123456.78

02 F1 85 3B

Integer x 100


Microsoft Excel always attempts to store a number as an RK number instead of an IEEE number. There is also a specific priority of RK number encoding that the program uses. The following flowchart is a simplified version of the encoding algorithm. The algorithm always begins with an IEEE (full 64-bit) number.

\doc\art\pg31.bmp

You can use the following C code to demonstrate how to decode RK numbers:

Microsoft QuickC™


double NumFromRk(long rk)
    {
    double num;
    if(rk & 0x02)
        {
        // int
        num = (double) (rk >> 2);
        }
    else
        {
        // hi words of IEEE num
        *((long *)&num+1) = rk & 0xfffffffc;
        *((long *)&num) = 0;
        }
    if(rk & 0x01)
        // divide by 100
        num /= 100;
    return num;
    }
main()
    {
    printf("%f\n", NumFromRk (0x02f1853b));
    }

THINK C


short double NumFromRk(long int rk)
    {
    short double num;
    if(rk & 0x02)
        {
        /* int */
        num = (short double) (rk >> 2);
        }
    else
        {
        /* hi words of IEEE num */
        *((long int *)&num + 1) = 0;
        *((long int *)&num) = rk & 0xfffffffc;
        }
    if(rk & 0x01)
        /* divide by 100 */
        num /= 100;
    return num;
    }
main()
    {
    printf("%f\n", NumFromRk (0x02f1853b));
    }

If you write a NUMBER record to a BIFF file, Microsoft Excel may convert the number to an RK number when it reads the file.

ROW: Describes a Row (208h)

A ROW record describes a single row on a Microsoft Excel sheet. ROW records and their associated cell records occur in blocks of up to 32 rows. Each block ends with a DBCELL record. For more information about row blocks and about optimizing your code when searching for cell records, see Finding Cell Records in BIFF Files.

Record Data

Offset

Name

Size

Contents

4

rw

2

Row number.

6

colMic

2

First defined column in the row.

8

colMac

2

Last defined column in the row, plus 1.

10

miyRw

2

Row height.

12

irwMac

2

Used by Microsoft Excel to optimize loading
the file; if you are creating a BIFF file, set irwMac to 0.

14

(Reserved)

2

16

grbit

2

Option flags.

18

ixfe

2

If fGhostDirty = 1 (see grbit field), this is the index to the XF record for the row. Otherwise, this field is undefined.

Note: ixfe uses only the low-order 12 bits of the field (bits 11–0). Bit 12 is fExAsc, bit 13 is fExDsc, and bits 14 and 15 are reserved. fExAsc and fExDsc are set to true if the row has extra space above or below, respectively.


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

2–0

07h

iOutLevel

Index to the outline level of the row

3

08h

(Reserved)

4

10h

fCollapsed

= 1 if the row is collapsed in outlining

5

20h

fDyZero

= 1 if the row height is set to 0 (zero)

0

6

40h

fUnsynced

= 1 if the font height and row height are not compatible

7

80h

fGhostDirty

= 1 if the row has been formatted, even if it contains all blank cells

1

7–0

FFh

(Reserved)


The rw field contains the 0-based row number. The colMic and colMac fields give the range of defined columns in the row.

The miyRw field contains the row height, in units of 1/20 of a point. The miyRw field may have the 8000h (215) bit set, indicating that the row is standard height. The low-order 15 bits must still contain the row height. If you hide the row — either by setting row height to 0 (zero) or by using the Hide command — miyRw still contains the original row height. This allows Microsoft Excel to restore the original row height when you click the Unhide button.

Each row can have default cell attributes that control the format of all undefined cells in the row. By specifying default cell attributes for a particular row, you are effectively formatting all the undefined cells in the row without using memory for those cells. Default cell attributes do not affect the formats of cells that are explicitly defined.

For example, if you want all of row 3 to be left-aligned, you could define all 256 cells in the row and specify that each individual cell be left-aligned. This would require storage for each of the 256 cells. An easy alternative would be to set the default cell for row 3 to be left-aligned and not define any individual cells in row 3.

RSTRING: Cell with Character Formatting (D6h)

When part of a string in a cell has character formatting, an RSTRING record is written instead of the LABEL record.

Record Data

Offset

Name

Size

Contents

4

rw

2

Row

6

col

2

Column

8

ixfe

2

Index to the XF record

10

cch

2

Length of the string

12

rgch

var

String

var

cruns

1

Count of STRUN structures

var

rgstrun

var

Array of STRUN structures


The STRUN structure contains formatting information about the string. A STRUN structure occurs every time the text formatting changes. The STRUN structure is described in the following table.

Offset

Name

Size

Contents

0

ich

1

Index to the first character to which the formatting applies

1

ifnt

1

Index to the FONT record


SAVERECALC: Recalculate Before Save (5Fh)

If the Recalculate Before Save option is selected in the Options dialog box, Calculation tab, then fSaveRecalc = 1.

Record Data

Offset

Name

Size

Contents

4

fSaveRecalc

2

= 1 to recalculate before saving


SCENARIO: Scenario Data (AFh)

This record stores information about an individual scenario.

Record Data

Offset

Name

Size

Contents

4

cref

2

Number of changing cells

6

fLocked

1

= 1 if the scenario is locked for changes

7

fHidden

1

= 1 if the scenario is hidden

8

cchName

1

Length of the name

9

cchComment

1

Length of the comment

10

cchNameUser

1

Length of the user name

11

rgch

var

Concatenation of the scenario name string, the user name string (preceded by a duplicate of cchNameUser), and the comment string (preceded by a duplicate of cchComment)

var

rgRef

var

Array of cell references that contains changing cells (see text)

var

rgst

var

Array of byte-counted strings that contains changing cell values (see text)

var

rgIfmt

var

Array of ifmt integers (see text)


The changing cells for the scenario are stored in the three arrays at the end of the record. The rgRef array contains the cell addresses, as shown in the following table.

Offset

Name

Size

Contents

0

rw

2

Row number (0-based)

2

col

2

Column number (0-based)


The cell values are always stored as an array of byte-counted strings, as shown in the following table.

Offset

Name

Size

Contents

0

cch

1

Length of the string

1

rgch

var

String


Finally, the cell number format indexes (ifmt) are stored as an array of 2-byte integers, following the array of cell value strings. These are stored only when the scenario contains cells with date/time number formats. If the cells contain any other number format, the rgIfmt will contain 0's (zeros).

SCENMAN: Scenario Output Data (AEh)

This records stores the general information about the set of scenarios on a worksheet.

Record Data

Offset

Name

Size

Contents

4

csct

2

Number of scenarios

6

isctCur

2

Index of the current scenario

8

isctShown

2

Index of the last displayed scenario

10

irefRslt

2

Number of reference areas in the following scenario result array

12

rgref

var

Scenario result array (see the following table)


Each reference area in the scenario result array contains the fields listed in the following table.

Offset

Name

Size

Contents

0

rwFirst

2

First row

2

rwLast

2

Last row

4

colFirst

1

First column

5

colLast

1

Last column


SCENPROTECT: Scenario Protection (DDh)

This record stores the scenario protection flag.

Record Data

Offset

Name

Size

Contents

4

fScenProtect

2

= 1 if scenarios are protected


SCL: Window Zoom Magnification (A0h)

This record stores the window zoom magnification.

Record Data

Offset

Name

Size

Contents

4

nscl

2

Numerator of a reduced fraction

6

dscl

2

Denominator of a reduced fraction


The magnification is stored as a reduced fraction. For example, if the magnification is 75%, nscl = 03h and dscl = 04h (3/4 = 0.75 = 75%). If the magnification is 11%, nscl = 0Bh (11 decimal) and dscl = 64h (100 decimal). If the BIFF file does not contain the SCL record, the magnification is 100%.

SELECTION: Current Selection (1Dh)

The SELECTION record stores the selection.

Record Data

Offset

Name

Size

Contents

4

pnn

1

Number of the pane described

5

rwAct

2

Row number of the active cell

7

colAct

2

Column number of the active cell

9

irefAct

2

Ref number of the active cell

11

cref

2

Number of refs in the selection

13

rgref

var

Array of refs


The pnn field indicates which pane is described. It contains one of the following values:

0 = lower-right
1 = upper-right
2 = lower-left
3 = upper-left

For a window that has no splits, the pnn field = 3.

The rwAct and colAct fields specify the active cell.

The irefAct field is a 0-based index into the array of ref structures (refs), specifying which ref contains the active cell. The rgref is an array because it is possible to create a multiple selection. In the case of a multiple selection, each selection is described by a ref, including the active cell (even if it is included in one of the other selections).

The selection (of cells) is described by the rgref array. The number of refs in the rgref field is equal to cref. Each ref in the array is 6 bytes long and contains the fields listed in the following table.

Offset

Name

Size

Contents

0

rwFirst

2

First row in the reference

2

rwLast

2

Last row in the reference

4

colFirst

1

First column in the reference

5

colLast

1

Last column in the reference


If a selection is so large that it exceeds the maximum BIFF record size, it is broken down into multiple consecutive SELECTION records. Each record contains a portion of the larger selection. Only the cref and rgref fields vary in the multiple records; the pnn, rwAct, colAct, and irefAct fields are the same across all records in the group.

SETUP: Page Setup (A1h)

The SETUP record stores options and measurements from the Page Setup dialog box.

Record Data

Offset

Name

Size

Contents

4

iPaperSize

2

Paper size (see fNoPls in the following table)

6

iScale

2

Scaling factor (see fNoPls in the following table)

8

iPageStart

2

Starting page number

10

iFitWidth

2

Fit to width; number of pages

12

iFitHeight

2

Fit to height; number of pages

14

grbit

2

Option flags (see the following table)

16

iRes

2

Print resolution (see fNoPls in the following table)

18

iVRes

2

Vertical print resolution (see fNoPls in the following table)

20

numHdr

8

Header margin (IEEE number)

28

numFtr

8

Footer margin (IEEE number)

36

iCopies

2

Number of copies (see fNoPls in the following table)


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fLeftToRight

Print over, then down.

1

02h

fLandscape

= 0, Landscape mode
= 1, Portrait mode
(see fNoPls below).

2

04h

fNoPls

= 1, then the iPaperSize, iScale, iRes, iVRes, iCopies, and fLandscape data have not been obtained from the printer, so they are not valid.

3

08h

fNoColor

= 1, print black and white.

4

10h

fDraft

= 1, print draft quality.

5

20h

fNotes

= 1, print notes.

6

40h

fNoOrient

= 1, orientation not set.

7

80h

fUsePage

= 1, use custom starting page number instead of Auto.

1

7–0

FFh

(Unused)


SHRFMLA: Shared Formula (BCh)

The SHRFMLA record is a file size optimization. It is used with the FORMULA record to compress the amount of storage required for the parsed expression (rgce). In earlier versions of Microsoft Excel, if you read an FORMULA record in which the rgce field contained a ptgExp parse token, the FORMULA record contained an array formula. In Microsoft Excel version 5.0, this could indicate either an array formula or a shared formula.

If the record following the FORMULA is an ARRAY record, the FORMULA record contains an array formula. If the record following the FORMULA is a SHRFMLA record, the FORMULA record contains a shared formula. You can also test the fShrFmla bit in the FORMULA record's grbit field to determine this.

When reading a file, you must convert the FORMULA and SHRFMLA records to an equivalent FORMULA record if you plan to use the parsed expression. To do this, take all of the FORMULA record up to (but not including) the cce field, and then append to that the SHRFMLA record from its cce field to the end. You must then convert some ptgs; this is explained later in this article.

Following the SHRFMLA record will be one or more FORMULA records containing ptgExp tokens that have the same rwFirst and colFirst fields as those in the ptgExp in the first FORMULA. There is only one SHRFMLA record for each shared-formula record group.

To convert the ptgs, search the rgce field from the SHRFMLA record for any ptgRefN, ptgRefNV, ptgRefNA, ptgAreaN, ptgAreaNV, or ptgAreaNA tokens. Add the corresponding FORMULA record's rw and col fields to the rwFirst and colFirst fields in the ptgs from the SHRFMLA. Finally, convert the ptgs as shown in the following table.

Convert this ptg

To this ptg

ptgRefN

ptgRef

ptgRefNV

ptgRefV

ptgRefNA

ptgRefA

ptgAreaN

ptgArea

ptgAreaNV

ptgAreaV

ptgAreaNA

ptgAreaA


For more information about ptgs and parsed expressions, see Microsoft Excel Formulas.

Remember that STRING records can appear after FORMULA records if the formula evaluates to a string.

If your code writes a BIFF file, always write standard FORMULA records; do not attempt to use the SHRFMLA optimization.

Record Data

Offset

Name

Size

Contents

4

rwFirst

2

First row

6

rwLast

2

Last row

8

colFirst

1

First column

9

colLast

1

Last column

10

(Reserved)

2

12

cce

2

Length of the parsed expression

14

rgce

var

Parsed expression


SORT: Sorting Options (90h)

This record stores options from the Sort and Sort Options dialog boxes.

Record Data

Offset

Name

Size

Contents

4

grbit

2

Option flags

6

cchKey1

1

Length of the string for sort key 1

7

cchKey2

1

Length of the string for sort key 2

8

cchKey3

1

Length of the string for sort key 3

9

rgchKey1

var

String for sort key 1

var

rgchKey2

var

String for sort key 2

var

rgchKey3

var

String for sort key 3


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

0001h

fCol

= 1 if the Sort Left To Right option is on.

1

0002h

fKey1Dsc

= 1 if key 1 sorts in descending order.

2

0004h

fKey2Dsc

= 1 if key 2 sorts in descending order.

3

0008h

fKey3Dsc

= 1 if key 3 sorts in descending order.

4

0010h

fCaseSensitive

= 1 if the sort is case-sensitive.

9–5

03E0h

iOrder

Index to the table in the First Key Sort Order option. The Normal sort order corresponds to iOrder = 0.

10

0400h

fAltMethod

Used only in Far East versions of Microsoft Excel.

15-11

F800h

(Reserved)


SOUND: Sound Note (96h)

The SOUND record contains the complete description of a sound note.

Record Data

Offset

Name

Size

Contents

4

cf

2

Clipboard format; 4257h (16983 decimal) for sound notes

6

env

2

Environment from which the file was written:
= 1, Microsoft Windows
= 2, Apple Macintosh

8

lcb

4

Length of the sound data

12

data

var

Sound data


STANDARDWIDTH: Standard Column Width (99h)

The STANDARDWIDTH record records the measurement from the Standard Width dialog box.

Record Data

Offset

Name

Size

Contents

4

DxGCol

2

Standard column width, in increments of 1/256 of a character width


STRING: String Value of a Formula (207h)

When a formula evaluates to a string, a STRING record occurs after the FORMULA record. If the formula is part of an array, the STRING record occurs after the ARRAY record.

Record Data

Offset

Name

Size

Contents

4

cch

2

Length of the string

6

rgch

var

String


STYLE: Style Information (293h)

Each style in a Microsoft Excel workbook, whether built-in or user-defined, requires a style record in the BIFF file. When Microsoft Excel saves the workbook, it writes the STYLE records in alphabetic order, which is the order in which the styles appear in the drop-down list box.

Record Data — Built-In Styles

Offset

Name

Size

Contents

4

ixfe

2

Index to the style XF record.

Note: ixfe uses only the low-order 12 bits of the field (bits 11–0). Bits 12, 13, and 14 are unused, and bit 15 (fBuiltIn) is 1 for built-in styles.

6

istyBuiltIn

1

Built-in style numbers:
= 00h Normal
= 01h RowLevel_n
= 02h ColLevel_n
= 03h Comma
= 04h Currency
= 05h Percent
= 06h Comma[0]
= 07h Currency[0]

7

iLevel

1

Level of the outline style RowLevel_n or ColLevel_n (see text).


Record Data — User-Defined Styles

Offset

Name

Size

Contents

4

ixfe

2

Index to the style XF record.

Note: ixfe uses only the low-order 12 bits of the field (bits 11–0). Bits 12, 13, and 14 are unused, and bit 15 (fBuiltIn) is 0 for user-defined styles.

6

cch

1

Length of the style name.

7

rgch

1

Style name.


The automatic outline styles — RowLevel_1 through RowLevel_7, and ColLevel_1 through ColLevel_7 — are stored by setting istyBuiltIn to 01h or 02h and then setting iLevel to the style level minus 1. If the style is not an automatic outline style, ignore this field.

SUB: Subscriber (91h)

The SUB record contains information about the publisher/subscriber feature. This record can be created only by Microsoft Excel for the Macintosh. However, if Microsoft Excel for any other platform encounters the SUB record in a BIFF file, it leaves the record in the file, unchanged, when the file is saved.

Record Data

Offset

Name

Size

Contents

4

ref

6

Reference structure describing the subscribed area on the worksheet.

10

drwReal

2

Actual number of rows in the subscribed area.

12

dcolReal

2

Actual number of columns in the subscribed area.

14

grbit

2

Option flags.

16

cbAlias

2

Size of rgbAlias.

18

sec

36

Section record associated with the subscribed area.

54

rgbAlias

var

Contents of the alias pointed to by the section record.

xvar

stz

var

Null-terminated string containing the path of publisher. The first byte is a length byte, which does not count the terminating null byte.


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

(Reserved)

1

02h

fObj

= 1 if subscribed in the object layer

7–2

FCh

(Reserved)

1

7–0

FFh

(Reserved)


SXDI: Data Item (C5h)

This record contains information about the PivotTable data item.

Record Data

Offset

Name

Size

Contents

4

isxvdData

2

Field that this data item is based on.

6

iiftab

2

Index to the aggregation function:
= 00h, Sum
= 01h, Count
= 02h, Average
= 03h, Max
= 04h, Min
= 05h, Product
= 06h, Count Nums
= 07h, StdDev
= 08h, StdDevp
= 09h, Var
= 0Ah, Varp

8

df

2

Data display format:
= 00h, Normal
= 01h, Difference from
= 02h, Percentage of
= 03h, Percentage difference from
= 04h, Running total in
= 05h, Percentage of row
= 06h, Percentage of column
= 07h, Percentage of total
= 08h, Index

10

isxvd

2

Index to the SXVD record used by the data display format.

12

isxvi

2

Index to the SXVI record used by the data display format.

14

ifmt

2

Index to the format table for this item.

16

cchName

2

Length of the name; if the name = FFFFh, rgch is null and the name in the PivotTable cache storage is used.

18

rgch

var

Name.


SXEXT: External Source Information (DCh)

This record stores information about the SQL query string that retrieves external data for a PivotTable. The record is followed by SXSTRING records that contain the SQL strings and then by a SXSTRING record that contains the SQL server connection string.

Record Data

Offset

Name

Size

Contents

4

id

2

Connection ID of the SQL server

6

fError

2

= 1 if an error occurred during the last attempt to communicate with the server

8

cstSQL

2

Number of SXSTRING records that follow


SXIDSTM: Stream ID (D5h)

This record is a header record for a group of SXVS, SXEXT, and SXSTRING records that describe the PivotTable streams in the SX DB storage (the PivotTable cache storage). The idstm field identifies the stream.

Record Data

Offset

Name

Size

Contents

4

idstm

2

Stream ID


SXIVD: Row/Column Field IDs (B4h)

This record stores an array of field ID numbers (2-byte integers) for the row fields and column fields in a PivotTable. Two SXIVD records appear in the file: the first contains the array of row field IDs, and the second contains the array of column field IDs.

Record Data

Offset

Name

Size

Contents

4

rgisxvd

var

Array of 2-byte integers; contains either row field IDs or column field IDs


SXLI: Line Item Array (B5h)

The SXLI record stores an array of variable-length SXLI structures, which describe the row and column items in a PivotTable. There are two SXLI records for each PivotTable: the first stores row items, and the second stores column items.

Record Data

Offset

Name

Size

Contents

4

rgsxli

var

Array of SXLI structures


The SXLI structure has variable length but will always be at least 10 bytes long, with one element in the rgisxvi array (the index to the SXVI record for the item). The SXLI structure is shown in the following table.

Offset

Name

Size

Contents

0

cSic

2

Count of items that are identical to the previous element in rgsxvi; for 0 <= i < cSic, rgisxvi[i] is the same as the previous line.

2

itmtype

2

Item type:
= 00h, Data
= 01h, Default
= 02h, SUM
= 03h, COUNTA
= 04h, COUNT
= 05h, AVERAGE
= 06h, MAX
= 07h, MIN
= 08h, PRODUCT
= 09h, STDEV
= 0Ah, STDEVP
= 0Bh, VAR
= 0Ch, VARP
= 0Dh, Grand total

4

isxviMac

2

Maximum index to the rgisxvi[i] array.

6

grbit

2

Option flags; see the following table.

8

rgisxvi

2

Array of indexes to SXVI records; the number of elements in the array is (isxviMac + 1).


The grbit field contains the flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

0001h

fMultiDataName

= 1, use the data field name for the subtotal (instead of using "Total").

8–1

01F7h

iData

For a multi-data subtotal, iData is the index to the data field.

9

0200h

fSbt

= 1, this item is a subtotal.

10

0400h

fBlock

= 1, this item is a block total.

11

0800h

fGrand

= 1, this item is a grand total.

12

1000h

fMultiDataOnAxis

= 1, this axis contains multi-data.

15–13

E000h

(Reserved)

Reserved; must be 0 (zero).


SXPI: Page Item (B6h)

This record contains information about the PivotTable page item.

Record Data

Offset

Name

Size

Contents

4

isxvi

2

Index to the SXVI record for the page item

6

isxvd

2

Index to the SXVD record for the page item

8

idObj

2

Object ID for the page item drop-down arrow


SXSTRING: String (CDh)

This record contains an SQL query string, an SQL server connection string, or a page item name from a multiple-consolidation PivotTable.

Record Data

Offset

Name

Size

Contents

4

cch

2

Length of the string

6

rgch

var

String


SXTBL: Multiple Consolidation Source Info (D0h)

This record stores information about multiple-consolidation PivotTable source data.

Record Data

Offset

Name

Size

Contents

4

cdref

2

Count (1-based) of DCONREF or DCONNAME records that follow the SXTBL record

6

csxtbpg

2

Count (1-based) of SXTBPG records that follow the DCONREF or DCONNAME records

8

grbitPages

2

(See the following table)


The grbitPages field contains an encoded count of page fields, as shown in the following table.

Offset

Bits

Mask

Name

Contents

0

14–0

7FFFh

cPages

Count (1-based) of page fields

15

8000h

fAutoPage

= 1 if the user selected the Create A Single Page Field For Me option in the PivotTable Wizard dialog box


SXTBPG: Page Item Indexes (D2h)

This record stores an array of page item indexes that represent the table references for a multiple-consolidation PivotTable.

Record Data

Offset

Name

Size

Contents

4

rgiitem

var

Array of 2-byte indexes to page items (iitem)


SXTBRGIITM: Page Item Name Count (D1h)

This record stores the number of page item names in a multiple-consolidation PivotTable. The names are stored in SXSTRING records that follow the SXTBRGIITM.

Record Data

Offset

Name

Size

Contents

4

cItems

2

Number of page item names (number of SXTBRGIITM records that follow)


SXVD: View Fields (B1h)

This record contains PivotTable view fields and other information.

Record Data

Offset

Name

Size

Contents

4

sxaxis

2

Axis:
= 0, no axis
= 1, row
= 2, column
= 4, page
= 8, data

6

cSub

2

Number of subtotals attached.

8

grbitSub

2

Item subtotal type (see the following table).

10

cItm

2

Number of items.

12

cchName

2

Length of the name; if the name = FFFFh, rgch is null and the name in the cache is used.

14

rgch

var

Name.


The subtotal type (grbitSub) bits are defined as shown in the following table.

Name

Contents

bitFNone

0000h

bitFDefault

0001h

bitFSum

0002h

bitFCounta

0004h

bitFAverage

0008h

bitFMax

0010h

bitFMin

0020h

bitFProduct

0040h

bitFCount

0080h

bitFStdev

0100h

bitFStdevp

0200h

bitFVar

0400h

bitFVarp

0800h


SXVI: View Item (B2h)

This record contains information about a PivotTable item.

Record Data

Offset

Name

Size

Contents

4

itmtype

2

Item type:
= FEh, Page
= FFh, Null
= 00h, Data
= 01h, Default
= 02h, SUM
= 03h, COUNTA
= 04h, COUNT
= 05h, AVERAGE
= 06h, MAX
= 07h, MIN
= 08h, PRODUCT
= 09h, STDEV
= 0Ah, STDEVP
= 0Bh, VAR
= 0Ch, VARP
= 0Dh, Grand total

6

grbit

2

Option flags

8

iCache

2

Index to the PivotTable cache.

10

cchName

2

Length of the name; if the name = FFFFh, rgch is null and the name in the cache is used.

12

rgch

var

Name.


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fHidden

= 1 if the item is hidden

1

02h

fHideDetail

= 1 if detail is hidden

7–2

FCh

(Reserved)

Reserved, must be 0 (zero)

1

7–0

FFh

(Reserved)

Reserved, must be 0 (zero)


SXVIEW: View Definition (B0h)

This record contains top-level PivotTable information.

Record Data

Offset

Name

Size

Contents

4

rwFirst

2

First row of the PivotTable

6

rwLast

2

Last row of the PivotTable

8

colFirst

2

First column of the PivotTable

10

colLast

2

Last column of the PivotTable

12

rwFirstHead

2

First row containing PivotTable headings

14

rwFirstData

2

First row containing PivotTable data

16

colFirstData

2

First column containing PivotTable data

18

iCache

2

Index to the cache

20

(Reserved)

2

Reserved; must be 0 (zero)

22

sxaxis4Data

2

Default axis for a data field

24

ipos4Data

2

Default position for a data field

26

cDim

2

Number of fields

28

cDimRw

2

Number of row fields

30

cDimCol

2

Number of column fields

32

cDimPg

2

Number of page fields

34

cDimData

2

Number of data fields

36

cRw

2

Number of data rows

38

cCol

2

Number of data columns

40

grbit

2

Option flags

42

itblAutoFmt

2

Index to the PivotTable autoformat

44

cchName

2

Length of the PivotTable name

46

cchData

2

Length of the data field name

48

rgch

var

PivotTable name, followed by the name of a data field


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

0001h

fRwGrand

= 1 if the PivotTable contains grand totals for rows

1

0002h

fColGrand

= 1 if the PivotTable contains grand totals for columns

2

0004h

(Reserved)

Reserved; must be 0 (zero)

3

0008h

fAutoFormat

= 1 if the PivotTable has an autoformat applied

4

0010h

fWH

= 1 if the width/height autoformat is applied

5

0020h

fFont

= 1 if the font autoformat is applied

6

0040h

fAlign

= 1 if the alignment autoformat is applied

7

0080h

fBorder

= 1 if the border autoformat is applied

8

0100h

fPattern

= 1 if the pattern autoformat is applied

9

0200h

fNumber

= 1 if the number autoformat is applied

15–10

FC00h

(Reserved)

Reserved; must be 0 (zero)


SXVS: View Source (E3h)

This record contains an integer that defines the data source for a PivotTable.

Record Data

Offset

Name

Size

Contents

4

vs

2

Data source:
= 01h, Microsoft Excel list or database
= 02h, External data source (Microsoft Query)
= 04h, Multiple consolidation ranges
= 08h, Another PivotTable
= 10h, A Scenario Manager summary report


TABID: Sheet Tab Index Array (13Dh) (New for BIFF7)

This record contains an array of sheet tab index numbers. The record is used by the Shared Lists feature.

The sheet tab indexes have type short int (2 bytes each). The index numbers are 0-based and are assigned when a sheet is created; the sheets retain their index numbers throughout their lifetime in a workbook. If you rearrange the sheets in a workbook, the rgiTab array will change to reflect the new sheet arrangement.

This record does not appear in BIFF5 files.

Record Data

Offset

Name

Size

Contents

4

rgiTab

var

Array of tab indexes


TABIDCONF: Sheet Tab ID of Conflict History (EAh)
(new for BIFF7)

This record contains the sheet tab index for the Conflict History worksheet. The record is used by the Shared Lists feature.

This record does not appear in BIFF5 files.

Record Data

Offset

Name

Size

Contents

4

itabConf

2

Sheet tab index for the Conflict History worksheet. If =FFFFh, the user has stopped sharing the workbook.


TABLE: Data Table (236h)

A TABLE record describes a data table created with the Table command (Data menu).

Record Data

Offset

Name

Size

Contents

4

rwFirst

2

First row of the table

6

rwLast

2

Last row of the table

8

colFirst

1

First column of the table

9

colLast

1

Last column of the table

10

grbit

2

Option flags

12

rwInpRw

2

Row of the row input cell

14

colInpRw

2

Column of the row input cell

16

rwInpCol

2

Row of the column input cell

18

colInpCol

2

Column of the column input cell


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fAlwaysCalc

Always calculate the formula.

1

02h

fCalcOnLoad

Calculate the formula when the file is opened.

2

04h

fRw

= 1 input cell is a row input cell.
= 0 input cell is a column input cell.

3

08h

fTbl2

= 1 if two-input data table.
= 0 if one-input data table.

7–4

F0h

(Unused)

1

7–0

FFh

(Unused)


The area (range of cells) in which the table is entered is defined by the rwFirst, rwLast, colFirst, and colLast fields. This area is the interior of the table and does not include the outer row or column (these contain the table formulas and/or input values).

In cases where the input cell is a deleted reference (the cell displays #REF!), the rwInp field is –1. The colInp field is not used in this case.

TEMPLATE: Workbook Is a Template (60h)

This record has no record data field. If the TEMPLATE record is present in the Book stream, it signifies that the workbook is a template. The TEMPLATE record, if present, must immediately follow the BOF record.

TOPMARGIN: Top Margin Measurement (28h)

The TOP MARGIN record specifies the top margin in inches when a sheet is printed. The num field is in 8-byte IEEE floating-point format.

Record Data

Offset

Name

Size

Contents

4

num

8

Top margin


UDDESC: Description String for Chart Autoformat (DFh)

This record stores the description string for a custom chart autoformat. The record is written only in the chart autoformat file (XL5GALRY.XLS in Microsoft Excel for Windows).

Record Data

Offset

Name

Size

Contents

4

cch

1

Length of the description string

5

rgch

var

Description string


UNCALCED: Recalculation Status (5Eh)

If the UNCALCED record is present in the Book stream, it indicates that the Calculate message was in the status bar when Microsoft Excel saved the file. This occurs if the sheet changed, the Manual calculation option was on, and the Recalculate Before Save option was off (Options dialog box, Calculation tab).

Record Data

Offset

Name

Size

Contents

4

(Reserved)

2

Reserved; must be 0 (zero)


VCENTER: Center Between Vertical Margins (84h)

If the Center On Page Vertically option is on in the Page Setup dialog box, Margins tab, then fVCenter = 1.

Record Data

Offset

Name

Size

Contents

4

fVCenter

2

= 1 if the sheet is to be centered between the vertical margins when printed


VERTICALPAGEBREAKS: Explicit Column Page Breaks (1Ah)

The VERTICALPAGEBREAKS record contains a list of explicit column page breaks. The cbrk field contains the number of page breaks. rgcol is an array of
2-byte integers that specifies columns. Microsoft Excel sets a page break before each column contained in the list of columns in the rgcol field. The columns must be sorted in ascending order.

Record Data

Offset

Name

Size

Contents

4

cbrk

2

Number of page breaks

6

rgcol

var

Array of columns


WINDOW1: Window Information (3Dh)

The WINDOW1 record contains workbook-level window attributes. The xWn and yWn fields contain the location of the window in units of 1/20 of a point, relative to the upper-left corner of the Microsoft Excel window client area. The dxWn and dyWn fields contain the window size, also in units of 1/20 of a point.

Record Data

Offset

Name

Size

Contents

4

xWn

2

Horizontal position of the window

6

yWn

2

Vertical position of the window

8

dxWn

2

Width of the window

10

dyWn

2

Height of the window

12

grbit

2

Option flags

14

itabCur

2

Index of the selected workbook tab (0-based)

16

itabFirst

2

Index of the first displayed workbook tab
(0-based).

18

ctabSel

2

Number of workbook tabs that are selected.

20

wTabRatio

2

Ratio of the width of the workbook tabs to the width of the horizontal scroll bar; to obtain the ratio, convert to decimal and then divide by 1000.


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fHidden

= 1 if the window is hidden

1

02h

fIconic

= 1 if the window is currently displayed as an icon

2

04h

(Reserved)

3

08h

fDspHScroll

= 1 if the horizontal scroll bar is displayed

4

10h

fDspVScroll

= 1 if the vertical scroll bar is displayed

5

20h

fBotAdornment

= 1 if the workbook tabs are displayed

7-6

C0h

(Reserved)

1

7-0

FFh

(Reserved)


WINDOW2: Sheet Window Information (23Eh)

The WINDOW2 record contains window attributes for a sheet in a workbook.

Record Data

Offset

Name

Size

Contents

4

grbit

2

Option flags

6

rwTop

2

Top row visible in the window

8

colLeft

2

Leftmost column visible in the window

10

rgbHdr

4

Row/column heading and gridline color


The grbit field contains the option flags shown in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fDspFmla

= 1 if the window should display formulas
= 0 if the window should display value

1

02h

fDspGrid

= 1 if the window should display gridlines

2

04h

fDspRwCol

= 1 if the window should display row and column headings

3

08h

fFrozen

= 1 if the panes in the window should be frozen

4

10h

fDspZeros

= 1 if the window should display 0 (zero) values
= 0 if the window should suppress display of 0 (zero) values

5

20h

fDefaultHdr

= 1 (see the following explanation)
= 0 use rgbHdr color

6

40h

fArabic

= 1 for the Arabic version of Microsoft Excel

7

80h

fDspGuts

= 1 if outline symbols are displayed

1

0

01h

fFrozenNoSplit

= 1 if the panes in the window are frozen but there is no split

1

02h

fSelected

= 1 if the sheet tab is selected

2

04h

fPaged

= 1 if the sheet is currently being displayed in the workbook window

7–3

F8h

(Reserved)


fDefaultHdr is 1 if the window's row and column headings and gridlines should be drawn in the window's default foreground color. If this field is 0, the RGB color in the rgbHdr field is used instead.

WINDOWPROTECT: Windows Are Protected (19h)

The WINDOWPROTECT record stores an option from the Protect Workbook dialog box.

Record Data

Offset

Name

Size

Contents

4

fLockWn

2

= 1 if the workbook windows are protected


WRITEACCESS: Write Access User Name (5Ch)

This record contains the user name, which is the name you type when you install Microsoft Excel. The stName field is always padded with spaces (20h) to make the field 31 characters long; however, only the first cch bytes contain the actual user name data.

Record Data

Offset

Name

Size

Contents

4

cch

1

Length of the user name

5

stName

31

User name, padded with spaces (20h)


WRITEPROT: Workbook Is Write-Protected (86h)

This record is 4 bytes long, and it has no record data field. If the WRITEPROT record is present in the Book stream, it signifies that the worksheet has a Write Reservation password (File menu, Save As command, Options dialog box). For information about the password (wResPass), see FILESHARING.

WSBOOL: Additional Workspace Information (81h)

This record stores information about workspace settings.

Record Data

Offset

Name

Size

Contents

4

grbit

2

Option flags


The grbit field contains the option flags listed in the following table.

Offset

Bits

Mask

Name

Contents

0

0

01h

fShowAutoBreaks

= 1 if automatic page breaks are visible

3–1

E0h

(Unused)

4

10h

fDialog

= 1 if the sheet is a dialog sheet

5

20h

fApplyStyles

= 0 if automatic styles are applied to an outline

6

40h

fRwSumsBelow

= 1 if summary rows appear below detail in an outline

7

80h

fColSumsRight

= 1 if summary columns appear to the right of detail in an outline

1

0

01h

fFitToPage

= 1 if the Fit option is on (Page Setup dialog box, Page tab)

1

02h

(Reserved)

3–2

06h

fDspGuts

= 1 if outline symbols are displayed

5–4

(Reserved)

6

fAee

= 1 if the Alternate Expression Evaluation option is on (Options dialog box, Calculation tab)

7

fAfe

= 1 if the Alternate Formula Entry option is on (Options dialog box, Calculation tab)


XCT: CRN Record Count (59h)

For BIFF files that contain CRN records, ccrn is the number of CRN records (type 5Ah) in the file. The CRN records immediately follow the XCT record.

Record Data

Offset

Name

Size

Contents

4

ccrn

2

Count of CRN records that follow


XF: Extended Format (E0h)

The XF record stores formatting properties for cells and styles. The ixfe of a cell record (BLANK, LABEL, NUMBER, RK, and so on) points to a cell XF record, and the ixfe of a STYLE record points to a style XF record. Note that in previous BIFF versions, the record number for the XF record was 43h.

A BIFF file can contain as many XF records as are necessary to describe the different cell formats and styles in a workbook. The XF records are written in a table in the workbook stream, and the index to the XF record table is a 0-based number called ixfe.

The workbook stream must contain a minimum XF table consisting of 15 style XF records and one cell XF record (ixfe=0 through ixfe=15). The first XF record (ixfe=0) is the XF record for the Normal style. The next 14 records (ixfe=1 through ixfe=14) are XF records that correspond to outline styles RowLevel_1, ColLevel_1, RowLevel_2, ColLevel_2, and so on. The last record (ixfe=15) is the default cell XF for the workbook.

Following these XF records are five additional style XF records (not strictly required) that correspond to the Comma, Comma [0], Currency, Currency [0], and Percent styles.

Cell XF Record

Record Data

Offset

Bits

Mask

Name

Contents

4

15–0

FFFFh

ifnt

Index to the FONT record.

6

15–0

FFFFh

ifmt

Index to the FORMAT record.

8

0

0001h

fLocked

= 1 if the cell is locked.

1

0002h

fHidden

= 1 if the cell is hidden.

2

0004h

fStyle

= 0 for cell XF.
= 1 for style XF.

3

0008h

f123Prefix

If the Transition Navigation Keys option is off (Options dialog box, Transition tab), f123Prefix = 1 indicates that a leading apostrophe (single quotation mark) is being used to coerce the cell's contents to a simple string.

If the Transition Navigation Keys option is on, f123Prefix = 1 indicates that the cell formula begins with one of the four Lotus 1-2-3 alignment prefix characters:
' left
" right
^ centered
\ fill

15–4

FFF0h

ixfParent

Index to the XF record of the parent style. Every cell XF must have a parent style XF, which is usually ixfeNormal = 0.

10

2–0

0007h

alc

Alignment:
0 = general
1 = left
2 = center
3 = right
4 = fill
5 = justify
6 = center across selection

3

0008h

fWrap

= 1 wrap text in cell.

10

6–4

0070h

alcV

Vertical alignment:
0 = top
1 = center
2 = bottom
3 = justify

7

0080h

fJustLast

(Used only in Far East versions of Microsoft Excel)

9–8

0300h

ori

Orientation of text in cell:
= 0 no rotation
= 1 text appears top-to-bottom; letters are upright
= 2 text is rotated 90 degrees counterclockwise
= 3 text is rotated 90 degrees clockwise

10

0400h

fAtrNum

= 1 if the ifmt is not equal to the ifmt of the parent style XF

11

0800h

fAtrFnt

= 1 if the ifnt is not equal to the ifnt of the parent style XF

12

1000h

fAtrAlc

= 1 if either the alc or the fWrap field is not equal to the corresponding field of the parent style XF

13

2000h

fAtrBdr

= 1 if any border line field (dgTop, and so on) is not equal to the corresponding field of the parent style XF

14

4000h

fAtrPat

= 1 if any pattern field (fls, icvFore, icvBack) is not equal to the corresponding field of the parent style XF

15

8000h

fAtrProt

= 1 if either the fLocked field or the fHidden field is not equal to the corresponding field of the parent style XF

12

6–0

007Fh

icvFore

Index to the color palette for the foreground color of the fill pattern

12–7

1F80h

icvBack

Index to the color palette for the background color of the fill pattern

13

2000h

fSxButton

= 1 if the XF record is attached to a PivotTable button

15–14

C000h

(Reserved)

14

5–0

003Fh

fls

Fill pattern

8–6

01C0h

dgBottom

Border line style (see the following illustration)

15–9

FE00h

icvBottom

Index to the color palette for the bottom border color

16

2–0

0007h

dgTop

Border line style (see the following illustration)

5–3

0038h

dgLeft

Border line style (see the following illustration)

8–6

01C0h

dgRight

Border line style (see the following illustration)

15–9

FE00h

icvTop

Index to the color palette for the top border color

18

6-0

007Fh

icvLeft

Index to the color palette for the left border color

13-7

3F80h

icvRight

Index to the color palette for the right border color

15–14

C000h

(Reserved)


Border Line Styles

The border line style fields — dgTop, dgLeft, dgBottom, dgRight — correspond to the options in the Format Cells dialog box, Border tab, as shown in the following illustration.

Style XF Record

The style XF record is identical to the cell XF record, except that some of the fields have slightly different meanings.

Record Data

Offset

Bits

Mask

Name

Contents

6

15–0

FFFFh

ifmt

Index to the FORMAT record

8

0

0001h

fLocked

= 1 if the cell is locked

1

0002h

fHidden

= 1 if the cell is hidden

2

0004h

fStyle

= 0 for cell XF.
= 1 for style XF.

3

0008h

f123Prefix

This bit is always = 0 for style XF.

15–4

FFF0h

ixfParent

For style XF records, this field equals FFFh (ixfNULL).

10

2–0

0007h

alc

Alignment:
0 = general
1 = left
2 = center
3 = right
4 = fill
5 = justify
6 = center across selection

3

0008h

fWrap

= 1 wrap text in cell.

6–4

0070h

alcV

Vertical alignment:
0 = top
1 = center
2 = bottom
3 = justify

7

0080h

fJustLast

(Used only in Far East versions of Microsoft Excel.)

9–8

0300h

ori

Orientation of text in cell:
= 0 no rotation.
= 1 text appears top-to-bottom; letters are upright.
= 2 text is rotated 90 degrees counterclockwise.
= 3 text is rotated 90 degrees clockwise.

10

0400h

fAtrNum

= 0 if the style includes Number (Style dialog box).

11

0800h

fAtrFnt

= 0 if the style includes Font (Style dialog box).

12

1000h

fAtrAlc

= 0 if the style includes Alignment (Style dialog box).

13

2000h

fAtrBdr

= 0 if the style includes Border (Style dialog box).

14

4000h

fAtrPat

= 0 if the style includes Patterns (shading) (Style dialog box).

15

8000h

fAtrProt

= 0 if the style includes Protection (cell protection) (Style dialog box).

12

6–0

007Fh

icvFore

Index to the color palette for the foreground color of the fill pattern.

12–7

1F80h

icvBack

Index to the color palette for the background color of the fill pattern.

13

2000h

fSxButton

This bit always = 0 for style XF.

15–14

C000h

(Reserved)

14

5–0

003Fh

fls

Fill pattern.

8–6

01C0h

dgBottom

Border line style (see the previous illustration).

15–9

FE00h

icvBottom

Index to the color palette for the bottom border color.

16

2–0

0007h

dgTop

Border line style (see the previous illustration).

5–3

0038h

dgLeft

Border line style (see the previous illustration).

8–6

01C0h

dgRight

Border line style (see the previous illustration).

15–9

FE00h

icvTop

Index to the color palette for the top border color.

18

6–0

007Fh

icvLeft

Index to the color palette for the left border color.

13–7

3F80h

icvRight

Index to the color palette for the right border color.

15–14

C000h

(reserved)


Finding Cell Records in BIFF Files

Microsoft Excel uses the INDEX and DBCELL records to optimize the lookup of cell records (RK, FORMULA, and so on). You can use these records to optimize your code when reading a BIFF file, or you can just read the entire workbook stream to find the cell values you want. The unoptimized method may be slower, depending on the size, structure, and complexity of the file.

If your code writes a BIFF file, you must include the INDEX and DBCELL records with correct values in the record fields. If you do not do this, Microsoft Excel will not be able to optimize lookup, and the program's performance will suffer, especially when the user tries to copy data out of the file that your application has written.

Microsoft Excel stores cell records in blocks that have at most 32 rows. Each row that contains cell records has a corresponding ROW record in the block, and each block contains a DBCELL record at the end of the block.

The following illustration shows how to use the INDEX record to locate the DBCELL records at the end of the record blocks. Notice that the stream position at the start of the first BOF record in the workbook stream is 6F1h. To find the start of each DBCELL record, add this number to each member of the rgibRw array in the INDEX record.

After your code has computed the location of the DBCELL records, you can use the dbRtrw field to find the location of the start of the first ROW record for each block. This field is stored as a positive long integer, although the offset is really a "negative" offset to an earlier position in the file. See the following illustration for details.

Finally, your code can compute the start of each cell record in the block by using the members in the rgdb array in the DBCELL record. The offsets in this array use the start of the second ROW record in the block as the initial offset. This is because the code has to read the first ROW record to know what the row number is (and then to make a decision based on the row number), and the stream pointer is at the start of the second ROW record after this. See the following illustration for details.

Microsoft Excel Formulas

This section describes how Microsoft Excel stores formulas. Formulas most commonly appear in rgce fields in FORMULA, ARRAY, and NAME records. In this section, formula is a synonym for parsed expression, which is the internal tokenized representation of a Microsoft Excel formula.

There are no changes to the tokenized representation of a Microsoft Excel formula from BIFF5 to BIFF7, therefore this information applies to both versions.

Parsed Expressions and Tokens

Microsoft Excel uses a modified reverse-Polish technique to store parsed expressions. A parsed expression contains a sequence of parse tokens, each of which is either an operand, an operator token, or a control token. Operand tokens push operands onto the stack. Operator tokens perform arithmetic operations on operands. Control tokens assist in formula evaluation by describing properties of the formula.

A token consists of two parts: a token type and a token value. A token type is called a ptg (parse thing) in Microsoft Excel. A ptg is 1 byte long and has a value from 01h to 7Fh. The ptgs above 7Fh are reserved.

The ptg specifies only what kind of information a token contains. The information itself is stored in the token value, which immediately follows the ptg. Some tokens consist of only a ptg, without an accompanying token value. For example, to specify an addition operation, only the token type ptgAdd is required. But to specify an integer operand, you must specify both ptgInt and the token value, which is an integer.

For example, assume that the formula =5+6 is in cell A1. The parsed expression for this formula consists of three tokens: two integer operand tokens (<token 1> and <token 2>) and an operator token (<token 3>), as shown in the following table.

<token 1>

<token 2>

<token 3>

ptgInt 0005h

ptgInt 0006h

ptgAdd


Notice that each ptgInt is immediately followed by the integer token value.

If you type this formula in cell A1 and then examine the FORMULA record (using the BiffView utility), you'll see the following:


00000  06 00 1d 00 00 00 00 00 0f 00 00 00 00 00 00 00
00010  26 40 00 00 00 00 e0 fc 07 00 1e 05 00 1e 06 00
00020  03 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

The first 26 bytes of the hex dump contain the record number, record length, rw, col, ixfe, num, grbit, chn, and cce fields. The remaining 7 bytes contain the two ptgInt (1Eh) tokens — which contain the token values that represent the integers 5 and 6 (0005h and 0006h) — and the ptgAdd (03h) token. If the formula were changed to =5*6, the third token would be ptgMul (05h). For more information about the FORMULA record, see FORMULA.

In many cases, the token value consists of a structure of two or more fields. In these cases, offset-0 (zero) is assumed to be the first byte of the token value — that is, the first byte immediately following the token type.

Microsoft Excel ptgs

The following table contains all ptgs that appear in BIFF files. All other ptgs are reserved.

The ptgSheet and ptgEndSheet tokens are no longer used. The external sheet references are contained in the ptgNameX, ptgRef3d, and ptgArea3d tokens.

Name

Ptg

Type

ptgExp

01h

control

ptgTbl

02h

control

ptgAdd

03h

operator

ptgSub

04h

operator

ptgMul

05h

operator

ptgDiv

06h

operator

ptgPower

07h

operator

ptgConcat

08h

operator

ptgLT

09h

operator

ptgLE

0Ah

operator

ptgEQ

0Bh

operator

ptgGE

0Ch

operator

ptgGT

0Dh

operator

ptgNE

0Eh

operator

ptgIsect

0Fh

operator

ptgUnion

10h

operator

ptgRange

11h

operator

ptgUplus

12h

operator

ptgUminus

13h

operator

ptgPercent

14h

operator

ptgParen

15h

control

ptgMissArg

16h

operand

ptgStr

17h

operand

ptgAttr

19h

control

ptgSheet

1Ah

(ptg DELETED)

ptgEndSheet

1Bh

(ptg DELETED)

ptgErr

1Ch

operand

ptgBool

1Dh

operand

ptgInt

1Eh

operand

ptgNum

1Fh

operand

ptgArray

20h

operand, reference class

ptgFunc

21h

operator

ptgFuncVar

22h

operator

ptgName

23h

operand, reference class

ptgRef

24h

operand, reference class

ptgArea

25h

operand, reference class

ptgMemArea

26h

operand, reference class

ptgMemErr

27h

operand, reference class

ptgMemNoMem

28h

control

ptgMemFunc

29h

control

ptgRefErr

2Ah

operand, reference class

ptgAreaErr

2Bh

operand, reference class

ptgRefN

2Ch

operand, reference class

ptgAreaN

2Dh

operand, reference class

ptgMemAreaN

2Eh

control

ptgMemNoMemN

2Fh

control

ptgNameX

39h

operand, reference class

ptgRef3d

3Ah

operand, reference class

ptgArea3d

3Bh

operand, reference class

ptgRefErr3d

3Ch

operand, reference class

ptgAreaErr3d

3Dh

operand, reference class

ptgArrayV

40h

operand, value class

ptgFuncV

41h

operator

ptgFuncVarV

42h

operator

ptgNameV

43h

operand, value class

ptgRefV

44h

operand, value class

ptgAreaV

45h

operand, value class

ptgMemAreaV

46h

operand, value class

ptgMemErrV

47h

operand, value class

ptgMemNoMemV

48h

control

ptgMemFuncV

49h

control

ptgRefErrV

4Ah

operand, value class

ptgAreaErrV

4Bh

operand, value class

ptgRefNV

4Ch

operand, value class

ptgAreaNV

4Dh

operand, value class

ptgMemAreaNV

4Eh

control

ptgMemNoMemNV

4Fh

control

ptgFuncCEV

58h

operator

ptgNameXV

59h

operand, value class

ptgRef3dV

5Ah

operand, value class

ptgArea3dV

5Bh

operand, value class

ptgRefErr3dV

5Ch

operand, value class

ptgAreaErr3dV

5Dh

operand, value class

ptgArrayA

60h

operand, array class

ptgFuncA

61h

operator

ptgFuncVarA

62h

operator

ptgNameA

63h

operand, array class

ptgRefA

64h

operand, array class

ptgAreaA

65h

operand, array class

ptgMemAreaA

66h

operand, array class

ptgMemErrA

67h

operand, array class

ptgMemNoMemA

68h

control

ptgMemFuncA

69h

control

ptgRefErrA

6Ah

operand, array class

ptgAreaErrA

6Bh

operand, array class

ptgRefNA

6Ch

operand, array class

ptgAreaNA

6Dh

operand, array class

ptgMemAreaNA

6Eh

control

ptgMemNoMemNA

6Fh

control

ptgFuncCEA

78h

operator

ptgNameXA

79h

operand, array class (NEW ptg)

ptgRef3dA

7Ah

operand, array class (NEW ptg)

ptgArea3dA

7Bh

operand, array class (NEW ptg)

ptgRefErr3dA

7Ch

operand, array class (NEW ptg)

ptgAreaErr3dA

7Dh

operand, array class (NEW ptg)


Expression Evaluation

Calculation of Microsoft Excel formulas is a straightforward process. A last-in, first-out (LIFO) stack, the operand stack, is maintained during calculation. When an operand is encountered, it's pushed onto the stack. When an operator is encountered, it operates on the topmost operand or operands. Operator precedence is irrelevant at evaluation time; operators are handled as soon as they're encountered.

There are three kinds of operators: unary, binary, and function. Unary operators, such as the minus sign that negates a number, operate only on the top operand. Binary operators, such as the addition operator, operate on the top two operands. Function operators, which implement Microsoft Excel functions, operate on a variable number of operands, depending on how many arguments the function accepts.

All operators work by popping the required operands from the stack, performing calculations, and then pushing the result back onto the operand stack.

Scanning a Parsed Expression

One fairly common operation you can perform on parsed expressions is to scan them, taking appropriate actions at each ptg. You can do this with a loop by using a pointer variable that points to the next ptg to scan. However, you must increment this pointer carefully, because different ptgs may have token values of different lengths.

One approach is to maintain an array with one element per ptg. Each element contains the size of the token value. To increment the pointer, add the array element corresponding to the current ptg to the pointer. One way of reducing the array size is to limit the array indexes to the range 0–3Fh and then index it using the reference-class ptg (the base ptg) instead of the value-class or array-class ptg. This is possible because the token value is the same for all classes of a particular ptg. For more information about operand classes, see ptg Values for Operand Tokens.

There are two tokens, ptgStr and ptgAttr (when bitFAttrChoose is true), that have variable length and are therefore exceptions to the preceding description. The first token, ptgStr, is followed by a variable-length string. The token value specifies the length of the string, so the pointer can be incremented by reading the string length (cch) and then adding the string length to the pointer.

The other token is ptgAttr when bitFAttrChoose is true. In this case, the token value contains an optimized CHOOSE function, which contains a variable-length sequence of word offsets in the cases (value1, value2, … arguments) for the CHOOSE function. For these, you can use the wCases field to calculate the pointer increment.

Unary Operator Tokens

The unary operator tokens for Microsoft Excel are described in the following paragraphs. These operators pop the top argument from the operand stack, perform a calculation, and then push the result back onto the operand stack.

ptgUplus: Unary Plus (ptg = 12h)

Has no effect on the operand.

ptgUminus: Unary Minus (ptg = 13h)

Negates the operand on the top of the stack.

ptgPercent: Percent Sign (ptg = 14h)

Divides the top operand by 100.

Binary Operator Tokens

There are several binary operator ptgs. All binary operator ptgs pop the top two arguments from the operand stack, perform the associated calculation, and then push the result back onto the operand stack.

ptgAdd: Addition (ptg = 03h)

Adds the top two operands.

ptgSub: Subtraction (ptg = 04h)

Subtracts the top operand from the second-to-top operand.

ptgMul: Multiplication (ptg = 05h)

Multiplies the top two operands.

ptgDiv: Division (ptg = 06h)

Divides the top operand by the second-to-top operand.

ptgPower: Exponentiation (ptg = 07h)

Raises the second-to-top operand to the power of the top operand.

ptgConcat: Concatenation (ptg = 08h)

Appends the top operand to the second-to-top operand.

ptgLT: Less Than (ptg = 09h)

Evaluates to TRUE if the second-to-top operand is less than the top operand; evaluates to FALSE otherwise.

ptgLE: Less Than or Equal (ptg = 0Ah)

Evaluates to TRUE if the second-to-top operand is less than or equal to the top operand; evaluates to FALSE otherwise.

ptgEQ: Equal (ptg = 0Bh)

Evaluates to TRUE if the top two operands are equal; evaluates to FALSE otherwise.

ptgGE: Greater Than or Equal (ptg = 0Ch)

Evaluates to TRUE if the second-to-top operand is greater than or equal to the top operand; evaluates to FALSE otherwise.

ptgGT: Greater Than (ptg = 0Dh)

Evaluates to TRUE if the second-to-top operand is greater than the top operand; evaluates to FALSE otherwise.

ptgNE: Not Equal (ptg = 0Eh)

Evaluates to TRUE if the top two operands are not equal; evaluates to FALSE otherwise.

ptgIsect: Intersection (ptg = 0Fh)

Computes the intersection of the top two operands. This is the Microsoft Excel space operator.

ptgUnion: Union (ptg = 10h)

Computes the union of the top two operands. This is the Microsoft Excel comma operator.

ptgRange: Range (ptg = 11h)

Computes the minimal bounding rectangle of the top two operands. This is the Microsoft Excel colon operator.

Operand Tokens: Constant

These operand tokens push a single constant operand onto the operand stack.

ptgMissArg: Missing Argument (Operand, ptg = 16h)

Indicates a missing argument to a Microsoft Excel function. For example, the second (missing) argument to the function DCOUNT(Database,,Criteria) would be stored as a ptgMissArg.

ptgStr: String Constant (Operand, ptg = 17h)

Indicates a string constant ptg followed by a string length field (00 to FFh) and the actual string.

Offset

Name

Size

Contents

0

cch

1

The length of the string

1

rgch

var

The string


ptgStr requires special handling when parsed expressions are scanned. For more information, see Scanning a Parsed Expression.

ptgErr: Error Value (Operand, ptg = 1Ch)

This ptg is followed by the 1-byte error value (err). For a list of error values, see BOOLERR.

Offset

Name

Size

Contents

0

err

1

An error value


ptgBool: Boolean (Operand, ptg = 1Dh)

This ptg is followed by a byte that represents TRUE or FALSE.

Offset

Name

Size

Contents

0

f

1

= 1 for TRUE
= 0 for FALSE


ptgInt: Integer (Operand, ptg = 1Eh)

This ptg is followed by a word that contains an unsigned integer.

Offset

Name

Size

Contents

0

w

2

An unsigned integer value


ptgNum: Number (Operand, ptg = 1Fh)

This ptg is followed by an 8-byte IEEE floating-point number.

Offset

Name

Size

Contents

0

num

8

An IEEE floating-point number


Operand Tokens

Operand tokens push operand values onto the operand stack. These values fall into one of three classes — reference class, value class, or array class — depending on what type of value the formula expects from the operand. The type of value is determined by the context of the operand when the formula is parsed by Microsoft Excel.

Reference Class

Some operands are required by context to evaluate to references. In this case, the term "reference" is a general term meaning one or more areas on a Microsoft Excel worksheet.

When the Microsoft Excel expression evaluator encounters a reference class operand, it pushes only the reference itself onto the operand stack; it doesn't dereference it to return the underlying value or values. For example, the function CELL("width",B5) pushes the reference class operand ptgRef (24h) for the second argument. This function returns the column width of cell B5; therefore, only the reference to B5 is required, and there's no need to dereference to the value stored in cell B5.

Value Class

This is the most common type of operand. Value class operands push a single dereferenced value onto the operand stack. For example, the formula =A1+1 pushes a value class operand ptgRefV (44h) for the cell reference A1.

Array Class

This operand pushes an array of values onto the operand stack. You can specify the values in an array constant or in a reference to cells. For example, the formula =SUM({1,2,3;4,5,6}) pushes an array class ptgArrayA (60h) to represent the arguments to the function.

ptg Values for Operand Tokens

The three classes of operand tokens are divided numerically, as shown in the following table.

Operand class

Ptg values

Reference

20h–3Fh

Value

40h–5Fh

Array

60h–7Fh


The arithmetic difference between ptg classes is 20h. This is the basis for forming the class variants of ptgs. Class variants of ptgs are formed from the reference class ptg, also known as the base ptg. To form the value class ptg from the base ptg, add 20h to the ptg and append V (for "value") to the ptg name. To form the array class ptg from the base ptg, add 40h to the ptg and append A (for "array") to the ptg name. These rules are summarized in the following table for a sample base ptg, ptgRef.

Class

Name

Ptg

Reference

ptgRef

24h

Value

ptgRefV

44h

Array

ptgRefA

64h


The following example is a suggested method for calculating the base ptg from any class variant.


    if (ptg & 40h)
        {
        /* Value class ptg. Set the 20h bit to 
           make it Reference class, then strip
           off the high-order bits. */
        ptgBase = (ptg | 20h) & 3Fh;
        }
    else
        {
        /* Reference or Array class ptg. The 20h bit 
           is already set, so just have to strip off
           the high-order bits. */
        ptgBase = ptg & 3Fh;
        }

A more efficient implementation would define a macro that computes the base ptg, as in the following example.


#define PtgBase(ptg) (((ptg & 0x40) ? (ptg | 0x20): ptg) & 0x3F)

Operand Tokens: Base

This section describes the operand tokens in their base form (also known as reference class operand tokens).

ptgArray: Array Constant (Operand, ptg = 20h)

Array constant followed by 7 reserved bytes.

The token value for ptgArray consists of the array dimensions and the array values. ptgArray differs from most other operand tokens in that the token value doesn't follow the token type. Instead, the token value is appended to the saved parsed expression, immediately following the last token. The format of the token value is shown in the following table.

Offset

Name

Size

Contents

0

ccol

1

The number of columns in the array constant

1

crw

2

The number of rows in the array constant

3

rgval

var

The array values


An array with 256 columns is stored with a ccol = 0, because a single byte cannot store the integer 256. This is unambiguous, because a zero-column array constant is meaningless.

The number of values in the array constant is equal to the product of the array dimensions, crw*ccol. Each value is either an 8-byte IEEE floating-point number or a string. The two formats for these values are shown in the following tables.

IEEE Floating-Point Number

Offset

Name

Size

Contents

0

grbit

1

= 01h

1

num

8

IEEE floating-point number


String

Offset

Name

Size

Contents

0

grbit

1

= 02h

1

cch

1

The length of the string

2

rgch

var

The string


If a formula contains more than one array constant, the token values for the array constants are appended to the saved parsed expression in order: first the values for the first array constant, then the values for the second array constant, and so on.

If a formula contains very long array constants, the FORMULA, ARRAY, or NAME record containing the parsed expression may overflow into CONTINUE records (to accommodate all of the array values). In such cases, an individual array value is never split between records, but record boundaries are established between adjacent array values.

The reference class ptgArray never appears in a Microsoft Excel formula; only the ptgArrayV and ptgArrayA classes are used.

ptgName: Name (Operand, ptg = 23h)

This ptg stores the index to a name. The ilbl field is a 1-based index to the table of NAME records in the workbook.

Offset

Name

Size

Contents

0

ilbl

2

Index to the NAME table

2

(reserved)

12

Reserved; must be 0 (zero)


ptgRef: Cell Reference (Operand, ptg = 24h)

This ptg specifies a reference to a single cell. It's followed by references for the row and column that contain the cell. The row number is encoded.

Offset

Name

Size

Contents

0

grbitRw

2

(See the following table)

2

col

1

The column of the reference


Only the low-order 14 bits of the grbitRw field store the row number of the reference. The 2 MSBs specify whether the row and column references are relative or absolute. The following table shows the bit structure of the grbitRw field.

Bits

Mask

Name

Contents

15

8000h

fRwRel

= 1 if the row offset is relative
= 0 otherwise

14

4000h

fColRel

= 1 if the column offset is relative
= 0 otherwise

13–0

3FFFh

rw

The row number or row offset (zero-based)


For example, cell C5 is row number 4, column number 2 (Microsoft Excel stores zero-based cell references). Therefore, the absolute reference $C$5 is stored in a ptgRef, as shown in the following file fragment.


24 04 00 02

In this case, grbitRw = 0004h and col = 02h. Notice that bits 14 and 15 of grbitRw are both 0 (zero).

The relative reference C5 is stored in a ptgRef, as shown in the following file fragment.


24 04 C0 02

In this case, where grbitRw = C004h and col = 02h, bits 14 and 15 of grbitRw are both 1.

Mixed references are stored in the same way, with appropriate coding in grbitRw.

ptgArea: Area Reference (Operand, ptg = 25h)

This ptg specifies a reference to a rectangle (range) of cells. ptgArea is followed by 6 bytes that define the first row, last row, first column, and last column of the rectangle. The numbers of the first and last rows are encoded.

Offset

Name

Size

Contents

0

grbitRwFirst

2

(See the following table)

2

grbitRwLast

2

(See the following table)

4

colFirst

1

The first column of the reference

5

colLast

1

The last column of the reference


Only the low-order 14 bits of the grbitRwFirst and grbitRwLast fields store the row offsets of the reference. The 2 MSBs of each field specify whether the row and column offset are relative or absolute. The following table shows the bit structure of the grbitRwFirst and grbitRwLast fields.

Bits

Mask

Name

Contents

15

8000h

fRwRel

= 1 if the row offset is relative
= 0 otherwise

14

4000h

fColRel

= 1 if the column offset is relative
= 0 otherwise

13–0

3FFFh

rw

The row number or row offset (zero-based)


ptgMemArea: Constant Reference Subexpression (Operand, ptg = 26h)

This ptg is used to optimize reference expressions. A reference expression consists of operands — usually references to cells or areas — joined by reference operators (intersection, union, and range). Three examples of reference expressions are given in the following table.

Reference expression

Evaluates to

(A1,C3,D3:D5)

Two single cells and a 3x1 area

(A1:C3) (B2:D4)

A 2x2 area (the space character is the intersection operator)

(Name C3)

The smallest area that contains both C3 and all the cells referenced in Name (the space character is the intersection operator)


Many reference expressions evaluate to constant references. In the preceding examples, the first two expressions always evaluate to the same reference. The third example doesn't evaluate to a constant reference because the name's definition may change, which might cause the reference expression to evaluate differently.

When a reference expression evaluates to a constant reference, Microsoft Excel stores the constant reference in the parsed formula through a ptgMemArea token. This saves time during expression evaluation, because the constant part of the expression is pre-evaluated. This part of the expression is known as a reference subexpression.

The token value for ptgMemArea consists of two parts: the length of the reference subexpression, and the value of the reference subexpression. The length is stored immediately following the ptgMemArea, whereas the value is appended to the saved parsed expression, immediately following the last token.

The format of the length is shown in the following table.

Offset

Name

Size

Contents

0

(reserved)

4

4

cce

2

The length of the reference subexpression


Immediately following this part of the token value is the reference subexpression itself.

The rest of the token value (that is, the value of the reference subexpression) is appended to the parsed expression in the format shown in the following table.

Offset

Name

Size

Contents

0

cref

2

The number of rectangles to follow

2

rgref

var

An array of rectangles


Each rgref rectangle is 6 bytes long and contains the fields listed in the following table.

Offset

Name

Size

Contents

0

rwFirst

2

The first row

2

rwLast

2

The last row

4

colFirst

1

The first column

5

colLast

1

The last column


If a formula contains more than one ptgMemArea, the token values are appended to the saved parsed expression in order: first the values for the first ptgMemArea, then the values for the second ptgMemArea, and so on.

If a formula contains very long reference expressions, the BIFF record containing the parsed expression may be too long to fit in a single record. Microsoft Excel will use CONTINUE records to store long formulas. However, an individual rgref rectangle is never split between records; record boundaries occur between successive rectangles. For more information about the CONTINUE records, see CONTINUE.

ptgMemErr: Erroneous Constant Reference Subexpression (Operand, ptg = 27h)

This ptg is closely related to ptgMemArea. It's used for pre-evaluating reference subexpressions that don't evaluate to references.

For example, consider the formula =SUM(C:C 3:3), which is the sum of the intersection of column C and row 3 (the space between C:C and 3:3 is the intersection operator). The argument to the SUM function is a valid reference subexpression that generates a ptgMemArea for pre-evaluation. However, if you delete column C, the formula adjusts to =SUM(#REF! 3:3). In this case, the argument to SUM is still a constant reference subexpression, but it doesn't evaluate to a reference. Therefore, a ptgMemErr is used for pre-evaluation.

The token value consists of the error value and the length of the reference subexpression. Its format is shown in the following table.

Offset

Name

Size

Contents

0

(reserved)

4

4

cce

2

The length of the reference subexpression


The reference subexpression will contain a ptgRefErr or ptgAreaErr.

ptgRefErr: Deleted Cell Reference (Operand, ptg = 2Ah)

This ptg specifies a cell reference that was adjusted to #REF! as a result of worksheet editing (such as cutting, pasting, and deleting). The ptgRefErr is followed by3 unused bytes.

Offset

Name

Size

Contents

0

(reserved)

3


The original base type of the adjusted ptg is ptgRef or ptgRefN.

ptgAreaErr: Deleted Area Reference (Operand, ptg = 2Bh)

This ptg specifies an area reference that was adjusted to #REF! as a result of worksheet editing (such as cutting, pasting, and deleting). The ptgAreaErr is followed by 6 unused bytes.

Offset

Name

Size

Contents

0

(reserved)

6


The original base type of the adjusted ptg is ptgArea or ptgAreaN.

ptgRefN: Cell Reference Within a Shared Formula (Operand, ptg = 2Ch)

Similar to its ptgRef counterpart, the ptgRefN specifies a reference to a single cell. It's followed by references for the row and column that contain the cell; the row number of the cell is encoded as bit fields.

In BIFF5 and later, ptgRefN is used only in shared formulas. In earlier versions of Microsoft Excel, ptgRefN was used in names.

Offset

Name

Size

Contents

0

grbitRw

2

(See the following table)

2

col

1

The column (or column offset) of the reference


Only the low-order 14 bits of the grbitRw field store the row number of the reference. The 2 MSBs specify whether the row and column references are relative or absolute. The following table shows the bit structure of the grbitRw field.

Bits

Mask

Name

Contents

15

8000h

fRwRel

= 1 if the row offset is relative
= 0 otherwise

14

4000h

fColRel

= 1 if the column offset is relative
= 0 otherwise

13–0

3FFFh

rw

The row number or row offset (zero-based)


The only difference between ptgRefN and ptgRef is in the way relative references are stored. Relative references in shared formulas are stored as offsets, not as row and column numbers (as in ptgRef). For more information, see SHRFMLA.

ptgAreaN: Area Reference Within a Shared Formula (Operand, ptg = 2Dh)

The ptgAreaN token specifies a reference to a rectangle of cells. Both the first row and last row are stored as bit fields.

In BIFF5 and later, ptgAreaN is used only in shared formulas. In earlier versions, it was used in names.

Offset

Name

Size

Contents

0

grbitRwFirst

2

The first row of the absolute reference or relative reference offset bit fields

2

grbitRwLast

2

The last row of the absolute reference or relative reference offset bit fields

4

colFirst

1

The first column of the reference or column offset

5

colLast

1

The last column of the reference or column offset


Only the low-order 14 bits of the grbitRwFirst and grbitRwLast fields store the row offsets of the reference. The 2 MSBs of each field specify whether the row and column offset are relative or absolute. The following table shows the bit structure of the grbitRwFirst and grbitRwLast fields.

Bits

Mask

Name

Contents

15

8000h

fRwRel

= 1 if the row offset is relative
= 0 otherwise

14

4000h

fColRel

= 1 if the column offset is relative
= 0 otherwise

13–0

3FFFh

rw

The row number or row offset (zero-based)


The only difference between ptgAreaN and ptgArea is in the way relative references are stored.

ptgNameX: Name or External Name (Operand, ptg = 39h)

This ptg stores the index to a name. If the name is in the current workbook (in which case ixals is negative), the ilbl field is a 1-based index to the table of NAME records. If the name is in another workbook (that is, if it's an external name), the ilbl field is a 1-based index to the table of EXTERNNAME records.

Offset

Name

Size

Contents

0

ixals

2

The index to the EXTERNSHEET records. If ixals is negative (for example, FFFFh), the name is in the current workbook.

2

(reserved)

8

10

ilbl

2

The index to the NAME or EXTERNNAME table (1-based).

12

(reserved)

12


ptgRef3d: 3-D Cell Reference (Operand, ptg = 3Ah)

This ptg stores a 3-D cell reference (for example, Sheet1:Sheet3!$A$1). If the reference is to another workbook (in which case ixals is positive), itabFirst isn't used (it will be 0000h), and itabLast is the ixals for the last sheet in the 3-D reference. If either itabFirst or itabLast is equal to FFFFh, that sheet is a deleted sheet.

Offset

Name

Size

Contents

0

ixals

2

The index to the EXTERNSHEET records. If ixals is negative (for example, FFFFh), the reference is in the current workbook.

2

(reserved)

8

10

itabFirst

2

The index to the first sheet in the 3-D reference (zero-based); see the text.

12

itabLast

2

The index to the last sheet in the 3-D reference (zero-based); see the text.

14

grbitRw

2

(See the following table.)

16

col

1

The column of the reference, or the column offset.


Only the low-order 14 bits of the grbitRw field store the row number of the reference. The 2 MSBs specify whether the row and column references are relative or absolute. The following table shows the bit structure of the grbitRw field.

Bits

Mask

Name

Contents

15

8000h

fRwRel

= 1 if the row offset is relative
= 0 otherwise

14

4000h

fColRel

= 1 if the column offset is relative
= 0 otherwise

13–0

3FFFh

rw

The row number or row offset (zero-based)


ptgArea3d: 3-D Area Reference (Operand, ptg = 3Bh)

This ptg stores a 3-D area reference (for example, Sheet1:Sheet3!A1:E9).

Offset

Name

Size

Contents

0

ixals

2

The index to the EXTERNSHEET records. If ixals is negative (for example, FFFFh), the reference is on another sheet in the same workbook.

2

(reserved)

8

10

itabFirst

2

The index to the first sheet in the 3-D reference (zero-based).

12

itabLast

2

The index to the last sheet in the 3-D reference (zero-based).

14

grbitRwFirst

2

The first row in the area; see the following table.

16

grbitRwLast

2

The last row in the area; see the following table.

18

colFirst

1

The first column of the reference, or the column offset.

19

colLast

1

The last column of the reference, or the column offset.


Only the low-order 14 bits of the grbitRwFirst and grbitRwLast fields store the row offsets of the reference. The 2 MSBs of each field specify whether the row and column offset are relative or absolute. The following table shows the bit structure of the grbitRwFirst and grbitRwLast fields.

Bits

Mask

Name

Contents

15

8000h

fRwRel

= 1 if the row offset is relative
= 0 otherwise

14

4000h

fColRel

= 1 if the column offset is relative
= 0 otherwise

13–0

3FFFh

rw

The row number or row offset (zero-based)


ptgRefErr3d: Deleted 3-D Cell Reference (Operand, ptg = 3Ch)

This ptg stores a 3-D cell reference that was adjusted to #REF! as a result of worksheet editing (such as cutting, pasting, and deleting). The ptgRefErr3d is identical to ptgRef3d.

ptgAreaErr3d: Deleted 3-D Area Reference (Operand, ptg = 3Dh)

This ptg stores a 3-D area reference that was adjusted to #REF! as a result of worksheet editing (such as cutting, pasting, and deleting). The ptgAreaErr3d is identical to ptgArea3d.

Control Tokens

ptgExp: Array Formula or Shared Formula (ptg = 01h)

This ptg indicates an array formula or a shared formula. When ptgExp occurs in a formula, it's the only token in the formula. This indicates that the cell containing the formula is part of an array or part of a shared formula. The actual formula is found in an ARRAY record.

The token value for ptgExp consists of the row and column of the upper-left corner of the array formula.

Offset

Name

Size

Contents

0

rwFirst

2

The row number of the upper-left corner

2

colFirst

2

The column number of the upper-left corner


ptgTbl: Data Table (ptg = 02h)

This ptg indicates a data table. When ptgTbl occurs in a formula, it's the only token in the formula. This indicates that the cell containing the formula is an interior cell in a data table; the table description is found in a TABLE record. Rows and columns that contain input values to be substituted in the table don't contain ptgTbl.

The token value for ptgTbl consists of the row and column of the upper-left corner of the table's interior.

Offset

Name

Size

Contents

0

rwFirst

2

The row number of the upper-left corner

2

colFirst

2

The column number of the upper-left corner


ptgParen: Parenthesis (ptg = 15h)

This ptg is used only when Microsoft Excel unparses a parsed expression (for example, to display it in the formula bar). This ptg isn't used to evaluate parsed expressions. It indicates that the previous token in the parsed expression should be in parentheses. If the previous token is an operand, only that operand is in parentheses. If the previous token is an operator, the operator and all of its operands are in parentheses.

For example, the formula =1+(2) is stored as follows:


ptgInt    0001h
ptgInt    0002h
ptgParen
ptgAdd

In this case, only the integer operand 2 is in parentheses.

The formula =(1+2) is stored as follows:


ptgInt    0001h
ptgInt    0002h
ptgAdd
ptgParen

In this example, the parenthesized quantity consists of the ptgAdd operator and both of its operands.

ptgAttr: Special Attribute (ptg = 19h)

This ptg is used for several different purposes. In all cases, the token value consists of a group of flag bits and a data word.

BIFF3 and BIFF4

Offset

Name

Size

Contents

0

grbit

1

Option flags

1

w

2

Data word


BIFF4 when bifFAttrSpace = 1

Offset

Name

Size

Contents

0

grbit

1

Option flags

1

bAttrSpace

1

Spacing attribute

2

bSpace

1

Number of spaces


The grbit field contains the option flags listed in the following table.

Bits

Mask

Name

Contents

0

01h

bitFAttrSemi

= 1 if the formula contains a volatile function

1

02h

bitFAttrIf

= 1 to implement an optimized IF function

2

04h

bitFAttrChoose

= 1 to implement an optimized CHOOSE function

3

08h

bitFAttrGoto

= 1 to jump to another location within the parsed expression

4

10h

bitFAttrSum

= 1 to implement an optimized SUM function

5

20h

bitFAttrBaxcel

= 1 if the formula is a BASIC-style assignment statement

6

40h

bifFAttrSpace

= 1 if the macro formula contains spaces after the equal sign (BIFF3 and BIFF4 only)

7

80

(Unused)


ptgAttr requires special handling when parsed expressions are scanned. For more information, see Scanning a Parsed Expression.

bitFAttrSemi

Set to 1 if the formula contains a volatile function — that is, a function that's calculated in every recalculation. If ptgAttr is used to indicate a volatile function, it must be the first token in the parsed expression. If grbit = bitFAttrSemi, then the b (or w) field is don't-care.

bitFAttrIf

Indicates an optimized IF function. An IF function contains three parts: a condition, a TRUE subexpression, and a FALSE subexpression. The syntax of an associated Microsoft Excel formula would be IF(condition, TRUE subexpression, FALSE subexpression).

bitFAttrIf immediately follows the condition portion of the parsed expression. The b (or w) field specifies the offset to the FALSE subexpression; the TRUE subexpression is found immediately following the ptgAttr token. At the end of the TRUE subexpression, there's a bitFAttrGoto token that causes a jump to beyond the FALSE subexpression. In this way, Microsoft Excel evaluates only the correct subexpression instead of evaluating both of them and discarding the wrong one.

The FALSE subexpression is optional in Microsoft Excel. If it's missing, the b (or w) field specifies an offset to beyond the TRUE subexpression.

bitFAttrChoose

Indicates an optimized CHOOSE function. The cCases (or wCases) field specifies the number of cases in the CHOOSE function. It's followed by an array of word offsets to those cases. The format of this complex token value is shown in the following table.

Offset

Name

Size

Contents

0

grbit

1

bitFAttrChoose (04h).

1

wCases

2

The number of cases in the CHOOSE function.

3

rgw

var

A sequence of word offsets to the CHOOSE cases. The number of words in this field is equal to wCases + 1.


bitFAttrGoto

Instructs the expression evaluator to skip part of the parsed expression during evaluation. The b (or w) field specifies the number of bytes (or words) to skip, minus 1.

bitFAttrSum

Indicates an optimized SUM function (a SUM that has a single argument). For example, the sum of the cells in a 3-D reference — which has the formula =SUM(Sheet1:Sheet3!C11) — generates a ptgAttr with bitFAttrSum TRUE. The b (or w) field is don't-care.

bifFAttrSpace

Indicates that a formula (macro sheet or worksheet) contains spaces or carriage returns. Microsoft Excel retains spaces and returns in macro sheet and worksheet formulas (in version 3.0 and earlier, spaces and returns would have been eliminated when the formula was parsed). The bAttrSpace field contains an attribute code, and the bSpace field contains the number of spaces or returns. The attribute codes are listed in the following table.

Attribute

Value

bitFSpace

00h

bitFEnter

01h

bitFPreSpace

02h

bitFPreEnter

03h

bitFPostSpace

04h

bitFPostEnter

05h

bitFPreFmlaSpace

06h


The bitFSpace and bitFEnter attributes indicate that bSpace contains the number of spaces or returns before the next ptg in the formula.

The bitFPreSpace, bitFPreEnter, bitFPostSpace, and bitFPostEnter attributes occur with a ptgParen. Because one ptgParen represents two matched parentheses, the ptgAttr must encode the position of the space or return if it occurs before either parenthesis. For example, the ptgs that express the worksheet formula =    ("spaces"    ), which contains four spaces before the opening and closing parentheses, would appear in a formula record as shown in the following table.

Hex dump

Ptg type

Decodes to

17 06 73 70 61 63 65 73

ptgStr

The string "spaces" (operand)

19 40 02 04

ptgAttr

Four spaces before the opening parenthesis

19 40 04 04

ptgAttr

Four spaces after the closing parenthesis

15

ptgParen

The enclose operand (ptgStr) in parentheses


The bitFPreFmlaSpace attribute provides compatibility with BIFF3, where spaces can occur only after the equal sign (before the formula) in macro formulas. If the spaces in a BIFF5/BIFF7 formula are also acceptable in a BIFF3 formula, Microsoft Excel writes a bitFPreFmlaSpace attribute to indicate as much.

ptgMemNoMem: Incomplete Constant Reference Subexpression (ptg = 28h)

This ptg is closely related to ptgMemArea. It's used to indicate a constant reference subexpression that couldn't be pre-evaluated because of insufficient memory.

The token value consists of the length of the reference subexpression, as shown in the following table.

Offset

Name

Size

Contents

0

(reserved)

4

4

cce

2

The length of the reference subexpression


ptgMemFunc: Variable Reference Subexpression (ptg = 29h)

This ptg indicates a reference subexpression that doesn't evaluate to a constant reference. Any reference subexpression that contains one or more of the following items will generate a ptgMemFunc.

Subexpression contains

Example

A function

OFFSET(ACTIVE.CELL(),1,1):$C$2

A name

INDEX(first_cell:$D$2,1,1)

An external reference

SALES.XLS!$A$1:SALES.XLS!$C$3


The token value consists of the length of the reference subexpression.

Offset

Name

Size

Contents

0

cce

2

The length of the reference subexpression


ptgMemAreaN: Reference Subexpression Within a Name (ptg = 2Eh)

This ptg contains a constant reference subexpression within a name definition. Unlike ptgMemArea, ptgMemAreaN isn't used to pre-evaluate the reference subexpression.

The token value consists of the length of the reference subexpression.

Offset

Name

Size

Contents

0

cce

2

The length of the reference subexpression


ptgMemNoMemN: Incomplete Reference Subexpression Within a Name (ptg = 2Fh)

This ptg is closely related to ptgMemAreaN. It's used to indicate a constant reference subexpression within a name that couldn't be evaluated because of insufficient memory.

The token value consists of the length of the reference subexpression, as shown in the following table.

Offset

Name

Size

Contents

0

cce

2

The length of the reference subexpression


Function Operators

The following paragraphs describe the function operator ptgs. All of these operators pop arguments from the operand stack, compute a function, and then push the result back onto the operand stack. The number of operands popped from the stack is equal to the number of arguments passed to the Microsoft Excel function. Some Microsoft Excel functions always require a fixed number of arguments, whereas others accept a variable number of arguments. The SUM function, for example, accepts a variable number of arguments.

Although they're operators, function tokens also behave like operands in that they can occur in any of the three ptg classes: reference, value, or array.

ptgFunc: Function, Fixed Number of Arguments (Operator, ptg = 21h)

This ptg indicates a Microsoft Excel function with a fixed number of arguments. The ptgFunc is followed by the index to the function table.

Offset

Name

Size

Contents

0

iftab

2

The index to the function table


ptgFuncVar: Function, Variable Number of Arguments (Operator, ptg = 22h)

This ptg indicates a Microsoft Excel function with a variable number of arguments. The ptgFuncVar is followed by the number of arguments (1 byte) and then the index to the function table (2 bytes).

Offset

Bits

Mask

Name

Contents

0

6–0

7Fh

cargs

The number of arguments to the function

7

80h

fPrompt

= 1, function prompts the user (macro functions that end with a question mark)

1

14–0

7FFFh

iftab

The index to the function table

15

8000h

fCE

The function is a command-equivalent