xls.txt ( File view )

  • By 2010-07-31
  • View(s):8
  • Download(s):0
  • Point(s): 1
			           MICROSOFT EXCEL FILE FORMAT

Microsoft Excel is a popular spreadsheet.  It uses a file format called BIFF (Binary
File Format).  There are many types of BIFF records.  Each has a 4 byte header.  The
first two bytes are an opcode that specifies the record type.  The second two bytes
specify record length.  Header values are stored in byte-reversed form (less significant
byte first).  The rest of the record is the data itself (Figure 2-1).
Figure 2-1.  BIFF record header.
                 |  Record Header    |  Record Body
Byte Number    	 |  0    1    2    3 |  0    1   ...
                -----------------------------------
Record Contents	 | XX | XX | XX | XX | XX | XX | ...
                -----------------------------------
                | opcode   | length  | data
				
Each X represents a hexadecimal digit
Two X's form a byte.  The least significant (low) byte of the opcode is byte 0 and the
most significant (high) byte is byte 1.  Similarly, the low byte of the record length
field is byte 2 and the high byte is byte 3.

BOF (Beginning of File)
The first record in every spreadsheet is always of the BOF type (Figure 2-2).  
Figure 2-2.  BOF record.
           |  Record Header    |    Record Body    |
Byte       |  0    1    2    3 |  0    1    2    3 |
           -----------------------------------------
Contents   | 09 | 00 | 04 | 00 | 02 | 00 | 10 | 00 |
           -----------------------------------------
           | opcode  | length  | version |  file   |
           |         |         |  number |  type   |
The first two bytes, arranged with the low byte first, show that the opcode for BOF is
09h.  The second two bytes indicate that the record body is 4 bytes long.  The first two
bytes of the body are the version number (2 for the initial version of Excel).  The last
two bytes are the file type.  Type 10h is a worksheet file.

Relating Spreadsheet Cells to Record Data Bytes
A spreadsheet appears on a screen or printout as a matrix of rectangular cells.  Each
column is identified by a letter at its top, and each row is identified by a number.
Thus cell A1 is in the first column and the first row.  Cell C240 is in the third column
and the 240th row.  This scheme identifies cells in a way easily understood by people.
However, it is not particularly convenient for computers, as they do not handle letters
efficiently.  They are best at dealing with binary numbers.  Thus, Excel stores cell
identifiers as binary numbers, that people can read as hexadecimal.  The first number in
the system is 0 rather than 1.
Figure 2-3, which shows the form of an INTEGER record, illustrates the storage of column
and row information.
Figure 2-3.  INTEGER record.
      |  Record Header    |  Record Body
Byte  |  0    1    2    3 |  0    1    2    3    4    5    6    7    8 |
      ------------------------------------------------------------------
Value | 02 | 00 | 09 | 00 | 00 | 00 | 02 | 00 | 00 | 00 | 00 | 39 | 00 |
      ------------------------------------------------------------------
      | opcode  | length  |   row   | column  |   rgbAttr    |    w    |
Opcode 2 indicates an integer record.  The length bytes show that the record body is 9
bytes long.  Row 0 in the body corresponds to spreadsheet row 1.  Row 1 corresponds to
spreadsheet row 2, and so on.  Column 2 corresponds to spreadsheet column C.  Thus,
Figure 2-3 deals with cell C1.  The next three bytes, labeled "rgbAttr," specify cell
attributes (Table 2-3).  The final pair of bytes, (labeled "w") holds the integer's
value.  Here it is 39H or 57 decimal.  Thus the record specifies that cell C1 of the
spreadsheet contains an integer with the value 57.
Standard File Record Order
Excel worksheet files have each record type in a predetermined position.  A file need
not have all types, but the ones that are present are always be in the same order.
Table 2-1 lists the record types for Excel document (spreadsheet) files, in the order
they would appear in a BIFF file.  Table 2-2 lists the types in opcode order.
Several record types in a BIFF file, namely, ROW, BLANK, INTEGER, NUMBER, LABEL,
BOOLERR, FORMULA, and COLUMN DEFAULT, describe the contents of a cell.  These records
contain a 3 byte attribute field labeled "rgbAttr".  The following table describes how
the  bits in the field correspond to cell attributes.
Table 2-1.  Cell Attributes
Byte Offset     Bit   Description                     Contents
     0          7     Cell is not hidden              0b
                      Cell is hidden                  1b
                6     Cell is not locked              0b
                      Cell is locked                  1b
                5-0   Reserved, must be 0             000000b
                7-6   Font number (4 possible)
                5-0   Cell format code
     2          7     Cell is not shaded              0b
                      Cell is shaded                  1b
                6     Cell has no bottom border       0b
                      Cell has a bottom border        1b
                5     Cell has no top border          0b
                      Cell has a top border           1b
                4     Cell has no right border        0b
                      Cell has a right border         1b
                3     Cell has no left border         0b
                      Cell has a left border          1b
                2-0   Cell alignment code 
                           general                    000b
                           left                       001b
                           center                     010b
                           right                      011b
                           fill                       100b
                           Multiplan default align.   111b
The font number field is a zero-based index into the document's table of fonts.  the
cell format code is a zero-based index into the document's table of picture formats.
There are 21 different standard formats.  Additional custom formats may be defined by
the user.  See the FONT and FORMAT record descriptions form additonal details.
Table 2-2.  Excel Record Type in Order of Appearance
Record Type                Opcode (Hexadecimal)
BOF                           09
FILEPASS                      2F
INDEX                         0B
CALCCOUNT                     0C
CALCMODE                      0D
PRECISION                     0E
REFMODE                       0F
DELTA                         10
ITERATION                     11
1904                          22
BACKUP                        40
PRINT ROW HEADERS             2A
PRINT GRIDLINES               2B
HORIZONTAL PAGE BREAKS        1B
VERTICAL PAGE BREAKS          1A
DEFAULT ROW HEIGHT            25
FONT                          31
FONT2                         32
HEADER                        14
FOOTER                        15
LEFT MARGIN                   26
RIGHT MARGIN                  27
TOP MARGIN                    28
BOTTOM MARGIN                 29
COLWIDTH                      24
EXTERNCOUNT                   16
EXTERNSHEET                   17
EXTERNNAME                    23
FORMATCOUNT                   1F
FORMAT                        1E
NAME                          18
DIMENSIONS                    00
COLUMN DEFAULT                20
ROW                           08
BLANK                         01
INTEGER                       02
NUMBER                        03
LABEL                         04
BOOLERR                       05
FORMULA                       06
ARRAY                         21
CONTINUE                      3C
STRING                        07
TABLE                         36
TABLE2                        37
PROTECT                       12
WINDOW PROTECT                19
PASSWORD                      13
NOTE                          1C
WINDOW1                       3D
WINDOW2                       3E
PANE                          41
SELECTION                     1D
EOF                           0A
Table 2-3.  Excel Record Types in Opcode Order 
Record Type             Opcode (hexadecimal)
DIMENSIONS                 00
BLANK                      01
INTEGER                    02
NUMBER                     03
LABEL                      04
BOOLERR                    05
FORMULA                    06
STRING                     07
ROW                        08
BOF                        09
EOF                        0A
INDEX                      0B
CALCCOUNT                  0C
CALCMODE                   0D
PRECISION                  0E
REFMODE                    0F
DELTA                      10
ITERATION                  11
PROTECT                    12
PASSWORD                   13
HEADER                     14
FOOTER                     15
EXTERNCOUNT                16
EXTERNSHEET                17
NAME                       18
WINDOW PROTECT             19
VERTICAL PAGE BREAKS       1A
HORIZONTAL PAGE BREAKS     1B
NOTE                       1C
SELECTION                  1D
FORMAT                     1E
FORMATCOUNT                1F
COLUMN DEFAULT             20
ARRAY                      21
1904                       22
EXTERNNAME                 23
COLWIDTH                   24
DEFAULT ROW HEIGHT         25
LEFT MARGIN                26
RIGHT MARGIN               27
TOP MARGIN                 28
BOTTOM MARGIN              29
PRINT ROW HEADERS          2A
PRINT GRIDLINES            2B
FILEPASS                   2F
FONT                       31
FONT2                      32
TABLE                      36
TABLE2                     37
CONTINUE                   3C
WINDOW1                    3D
WINDOW2                    3E
BACKUP                     40
PANE                       41

Worksheet Record Types in Opcode Order
The following section lists all record types in opcode order.  It gives a specification
and byte-by-byte breakdown of each type.  Note that Excel terminology refers to
spreadsheets or worksheets as "documents."
DIMENSIONS                  00h                         0d

R
...
...
(Not finished, please download and read the complete file)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
index.htm66.63 kB24-03-99|22:05
binary0.00 B27-01-04|20:12
arc.htm4.53 kB18-03-99|04:12
ARJ.htm8.27 kB18-03-99|04:12
cab.zip43.49 kB11-12-98|03:08
lzh.htm2.08 kB18-03-99|04:12
tar.htm12.38 kB18-03-99|04:12
comm0.00 B27-01-04|20:12
clarion.zip32.79 kB11-12-98|03:09
dbase.htm5.56 kB18-03-99|04:12
dbf.htm2.99 kB18-03-99|04:12
ntx.htm11.44 kB18-03-99|04:12
paradox.rtf61.50 kB29-01-99|17:09
wks.zip22.04 kB11-12-98|03:09
xls.txt44.32 kB29-01-99|17:30
data0.00 B27-01-04|20:12
ai30.pdf260.00 kB29-03-98|22:54
bmp.htm46.13 kB18-03-99|04:12
Bmp.html37.97 kB18-03-99|04:12
BW.htm2.71 kB18-03-99|04:12
col.htm2.02 kB18-03-99|04:12
draft-bo.rtf240.19 kB14-03-99|00:24
dwg_ff.htm11.31 kB18-03-99|04:12
dxf.htm86.74 kB18-03-99|04:12
dxf12.htm140.73 kB18-03-99|04:12
dxf13.zip143.43 kB11-12-98|02:44
dxf14htm.zip160.37 kB11-12-98|02:48
DXF_R14.HLP201.27 kB24-06-98|19:27
emf.hlp73.22 kB17-10-95|23:53
gif87.htm29.98 kB18-03-99|04:12
Gif89a.doc83.47 kB29-10-90|08:27
grap.htm14.76 kB18-03-99|04:12
Ico.zip114.21 kB27-01-99|19:13
jpg.pdf93.35 kB29-03-98|22:59
jpg.rtf15.97 kB23-01-99|01:36
lzw.htm6.44 kB18-03-99|04:12
lzwexp.htm17.13 kB18-03-99|04:12
PCD.htm5.46 kB18-03-99|04:12
pcx.htm26.13 kB18-03-99|04:12
pic.htm4.49 kB18-03-99|04:12
PSD.pdf368.64 kB18-04-97|19:01
ps_plug.pdf377.16 kB29-03-98|22:59
rle.pdf31.59 kB29-03-98|23:06
tga.htm45.46 kB18-03-99|04:12
tga2.zip54.38 kB10-12-98|19:48
tif.pdf365.72 kB29-03-98|23:07
YUV.htm3.96 kB18-03-99|04:12
graphics0.00 B27-01-04|20:12
agentref.zip11.06 kB11-12-98|03:18
bbs.htm12.85 kB18-03-99|04:12
bluewave.htm43.85 kB18-03-99|04:12
idx.htm3.68 kB18-03-99|04:12
url.htm1.61 kB18-03-99|04:12
uuencode.htm11.10 kB18-03-99|04:12
Vrml.rtf70.88 kB28-01-99|14:10
VRML2.hlp181.23 kB21-02-98|20:57
internet0.00 B27-01-04|20:12
jpg0.00 B27-01-04|20:12
escode.rtf49.26 kB08-02-99|21:53
Intel.rtf130.99 kB08-02-99|21:50
joystick.rtf14.53 kB08-02-99|21:57
keyboard.rtf14.81 kB08-02-99|21:59
mouse.rtf15.75 kB08-02-99|22:00
pcl5.zip92.62 kB13-12-98|04:33
speaker.rtf16.96 kB08-02-99|22:04
VGA.htm29.31 kB18-03-99|04:12
other0.00 B27-01-04|20:12
cd.htm26.36 kB18-03-99|04:12
cda.htm2.98 kB18-03-99|04:12
mid1.htm16.87 kB18-03-99|04:12
midi2.htm12.08 kB18-03-99|04:12
midi3.htm10.51 kB18-03-99|04:12
MIND1-2.htm7.09 kB18-03-99|04:12
MPEG.zip573.61 kB11-12-98|04:02
mpeg1.zip65.24 kB11-12-98|03:45
Wav.rtf30.08 kB25-01-99|00:30
wave.htm104.17 kB18-03-99|04:12
sound0.00 B27-01-04|20:12
adobe_EPSF1_2.pdf12.64 kB29-03-98|22:51
adobe_EPSF2_0.pdf42.59 kB29-03-98|22:51
adobe_EPSF3_0.pdf127.45 kB29-03-98|22:54
afont.htm9.14 kB18-03-99|04:12
font.htm17.99 kB18-03-99|04:12
rtf.rtf158.74 kB25-01-99|01:41
rtf.zip147.10 kB11-12-98|03:32
word60.rtf463.82 kB25-01-99|03:24
word8.htm532.04 kB18-03-99|04:12
Wordpf.htm3.29 kB18-03-99|04:12
wordst.htm51.88 kB18-03-99|04:12
wri.htm21.84 kB18-03-99|04:12
text0.00 B27-01-04|20:13
ani.htm3.05 kB18-03-99|04:12
Bmp.html33.82 kB18-03-99|04:12
cab.zip43.49 kB11-12-98|03:08
cal.htm5.64 kB18-03-99|04:12
clp.htm2.33 kB18-03-99|04:12
crd.htm4.59 kB18-03-99|04:12
find.htm4.38 kB18-03-99|04:12
grp.htm8.54 kB18-03-99|04:12
Hlp.htm57.27 kB18-03-99|04:12
Hpj.doc71.12 kB14-01-93|06:22
Ico.zip114.21 kB27-01-99|19:13
icons.htm28.52 kB18-03-99|04:12
inf.htm2.74 kB18-03-99|04:12
Lnk.htm5.24 kB18-03-99|04:12
LONG.htm3.15 kB18-03-99|04:12
reg.htm11.13 kB18-03-99|04:12
res32.htm16.18 kB18-03-99|04:12
rle.pdf31.59 kB29-03-98|23:06
rtfwr.htm8.10 kB18-03-99|04:12
scr.htm1.69 kB18-03-99|04:12
ttfspec1.zip752.40 kB28-01-99|12:00
ttfspec2.zip501.01 kB27-01-99|20:51
Wav.rtf30.08 kB25-01-99|00:30
wave.htm101.51 kB18-03-99|04:12
wavec.htm205.63 kB18-03-99|04:12
WinReg.htm22.02 kB18-03-99|04:12
wmf.htm11.82 kB18-03-99|04:12
wri.htm21.84 kB18-03-99|04:12
windows0.00 B27-01-04|20:13
FORMAT0.00 B27-01-04|20:12
文件格式大全0.00 B27-01-04|20:12
...
Sponsored links

xls.txt (4.88 MB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D