?? excel.txt
字號:
MICROSOFT EXCEL BINARY FILE FORMAT ---------------------------------- Mark O'Brien Microsoft Corporation 18-Feb-1988Table of Contents----------------- Introduction General BIFF Record Format Rows and Columns Within BIFF Cell Table - Concepts Cell Records Record Types Cell Attributes Order of Records Finding Values From BIFF Files Excel Formulas Expression Evaluation Unary Operators Binary Operators Operand Tokens - Constant Operand Tokens - Classes Operand Tokens - Base Control Tokens Function Operators Reserved Ptg's Scanning a Parsed Expression Excel Function Table Command Equivalent Function Table List of Ptg'sIntroduction------------ BIFF (BInary File Format) is the file format in which Excel documents are saved on disk. A BIFF file is a complete description of an Excel document. BIFF was designed to satisfy the following goals: - Easy to understand and use - Easy to expand the file format for future needs - Files should save and load quickly BIFF files consist of sequences of variable-length records. There are many different types of BIFF records. For example, one record type describes a formula entered into a cell; one describes the size and location of a window into a document; another describes a picture format.General BIFF Record Format-------------------------- Although different BIFF record types contain different information, every record follows the same basic format: - Record type. This tells us what kind of data the record contains (e.g. a formula, a window, or a picture format). - Record length. This tells us how long the data contained in the record is. The length of a record depends on the type of data it contains. For example, a window record may always be the same length, containing just the size and location of a window, while a formula record varies in length, depending on the length of the formula itself. - Record data. This is the variable-length portion of the record containing the actual data. All BIFF records are in the following format: Offset Length Contents ------ ------ -------- 0 word record type 2 word length of data portion 4 varies data portion of record The data portion of a BIFF record must be no longer than 2080 bytes long. Thus, counting the record type and length fields, the maximum length of a BIFF record is 2084 bytes. Within this document, all numbers are decimal numbers unless they are preceded by "0x", in which case they are hexadecimal. Some portions of BIFF records are marked as RESERVED. These portions are unavailable for application use. If they are marked "RESERVED - must be zero", then a BIFF-related application should ensure that their contents are always filled with zeros. If they are marked simply RESERVED, then they do not need to be set to any particular value.Rows and Columns Within BIFF---------------------------- Within BIFF files, rows and columns are always stored zero-based, rather than one-based as they appear on the screen. For example, cell A1 is stored as row 0, column 0; cell B3 is row 2, column 1.Cell Table - Concepts--------------------- Microsoft Excel uses a sparse cell table to reduce memory requirements as much as possible. Cells that don't have values or formulas in them, have default format attributes, and are not referenced in any other formulas, are undefined cells and do not have any memory allocated for them. 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. Entire rows can be undefined, if they have no defined cells in them. In this case, only rows 3, 4, and 10 are defined.Cell Records------------ The term "cell record" refers to a BIFF record that defines a cell on an Excel document. A cell record is one of the following types: BLANK INTEGER NUMBER LABEL BOOLERR FORMULA The following records can occur in conjunction with cell records: CONTINUE ARRAY TABLE TABLE2Record Types------------ Here are the record types defined in BIFF. The record type and record length fields have been omitted from the descriptions, but they are present in every record.BOF record - beginning of file (type = 9) Offset Name Size Contents ------ ---- ---- -------- 4 vers 2 version number 6 dt 2 document type 0x10 = worksheet 0x40 = macro sheet Description The BOF must be the first record in every BIFF file. The version number for Excel documents is currently 2; Microsoft may change this number in the future, as BIFF is modified for future needs. Currently defined version numbers are: Value Name Meaning ----- ---- ------- 2 versExcel Excel document 3 versMP Multiplan document All other version numbers are reserved for future use by Microsoft. The high byte of the version number contains flag bits. Current flag values are: Mask Name Meaning ---- ---- ------- 0x0100 bitFMP =1 if the BIFF file is a Multiplan document 0xFE00 RESERVED for future use - must be zeros The dt field specifies whether the document is a worksheet or a macro sheet. Chart BIFF files are different and are not described in this document.FILEPASS record - file password key (type = 47) Description The FILEPASS record is used for an Excel document which was saved with a password in the File Save As command. If this record appears, it must directly follow the BOF record. All subsequent BIFF records will be encrypted, so you cannot read a password-protected BIFF file. Note that this record specifies a file password, as opposed to the PASSWORD record, which specifies a document password.INDEX record - ROW record index (type = 11) Offset Name Size Contents ------ ---- ---- -------- 4 ibRtName 4 absolute file position of the first NAME record 8 rwMic 2 first row that exists on the document 10 rwMac 2 last row that exists on the document, plus 1 12 rgibRw var array of absolute file positions of the blocks of ROW records Description The INDEX record is used to optimize searching through a file for a particular cell or name. This record is optional; if it occurs, it must occur directly after the document's FILEPASS record. If the document has no FILEPASS record, then the INDEX record must occur directly after the BOF record. The ibRtName field gives the absolute file offset (0 = beginning of file) of the first NAME record. rwMic and rwMac are the range of defined rows in the document. The rgibRw field is an array of 4-byte absolute file offsets to the document's ROW records. Excel always writes an INDEX record when it saves a BIFF file. If you are writing a BIFF file, you should probably not attempt to write an INDEX record. The INDEX record is explained more fully in the section "Finding Values From BIFF Files."CALCCOUNT record - iteration count (type = 12) Offset Name Size Contents ------ ---- ---- -------- 4 cIter 2 iteration count Description The CALCCOUNT record specifies the iteration count as set in the Options Calculation command.CALCMODE record - calculation mode (type = 13) Offset Name Size Contents ------ ---- ---- -------- 4 fAutoRecalc 2 calculation mode =0 for manual =1 for automatic =-1 for automatic, no tables Description The CALCMODE record specifies the calculation mode as set in the Options Calculation command.PRECISION record - precision (type = 14) Offset Name Size Contents ------ ---- ---- -------- 4 fFullPrec 2 document precision =1 for full precision =0 for precision as displayed Description The PRECISION record specifies the precision as set in the Options Calculation command.REFMODE record - reference mode (type = 15) Offset Name Size Contents ------ ---- ---- -------- 4 fRefA1 2 reference mode =1 for A1 mode =0 for R1C1 mode Description The REFMODE record specifies the reference mode as set in the Options Desktop command.DELTA record - maximum iteration change (type = 16) Offset Name Size Contents ------ ---- ---- -------- 4 numDelta 8 maximum change for iteration Description The DELTA record specifies the maximum change for an iterative model, as set in the Options Calculation command. The number is in 8-byte IEEE floating point format.ITERATION record - iteration flag (type = 17) Offset Name Size Contents ------ ---- ---- -------- 4 fIter 2 iteration flag =1 for iteration on =0 for iteration off Description The ITERATION record specifes the state of iteration as set in the Options Calculation command.1904 record - date system (type = 34) Offset Name Size Contents ------ ---- ---- -------- 4 f1904 2 =1 if the document uses the 1904 date system =0 otherwise Description The 1904 record specifies the date system used in an Excel document, as specified in the Options Calculation command.BACKUP record - file backup option (type = 64) Offset Name Size Contents ------ ---- ---- -------- 4 fBackupFile 2 =1 if Excel should save a backup version of the file when it is saved =0 otherwise Description The BACKUP record specifies whether or not Excel should save backup versions of a BIFF file, as specified in the "Create Backup File" checkbox in the Save As dialog box.PRINT ROW HEADERS record - print row headers flag (type = 42) Offset Name Size Contents ------ ---- ---- -------- 4 fPrintRwCol 2 =1 if we should print row and column headers when printing the document =0 otherwise Description The PRINT ROW HEADERS record controls whether or not Excel prints row and column headers when printing the document.PRINT GRIDLINES record - print gridlines flag (type = 43) Offset Name Size Contents ------ ---- ---- -------- 4 fPrintGrid 2 =1 if we should print gridlines when printing the document =0 otherwise Description The PRINT GRIDLINES record controls whether or not Excel prints gridlines when printing the document.HORIZONTAL PAGE BREAKS record - row page breaks (type = 27) Offset Name Size Contents ------ ---- ---- -------- 4 cbrk 2 number of page breaks 6 rgrw var array of rows Description The HORIZONTAL PAGE BREAKS record contains a list of explicit row page breaks. The cbrk field contains the number of page breaks. rgrw is an array of 2-byte integers specifying rows. Excel sets a page break before each row in the list. The rows must be sorted in increasing order.VERTICAL PAGE BREAKS record - column page breaks (type = 26) Offset Name Size Contents ------ ---- ---- -------- 4 cbrk 2 number of page breaks 6 rgcol var array of columns Description The VERTICAL PAGE BREAKS 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 specifying columns. Excel sets a page break before each column in the list. The columns must be sorted in increasing order.DEFAULT ROW HEIGHT record - default row height (type = 37) Offset Name Size Contents ------ ---- ---- -------- 4 miyRwGhost 2 default row height Description The DEFAULT ROW HEIGHT record specifies the height of all undefined rows in the document. The miyRwGhost field contains the row height in units of 1/20 of a point. This record does not affect the row heights of any rows that are explicitly defined.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -