简体   繁体   中英

In a ms-xlsb worksheet what are the undocumented 6 bytes between brtcolortab and rwsync

I'm trying to write an application to read a XLSB file. I'm using the specification here https://interoperability.blob.core.windows.net/files/MS-XLSB/%5bMS-XLSB%5d.pdf . My main objective (for now) is to read a worksheets CELLTABLE which requires me to read the structures that come before it. I've gotten as far as reading the BrtWSDim record. My concern is there are two strings of bytes that appear in the format that don't appear to be documented. Would anyone be able to point me to where I might learn more about these undocumented regions? I've labeled them below as "reserved (undocumented)":

All bits/bytes displayed little endian

A - fShowAutoBreaks (1 bit): 1  
B - reserved1 (2 bits): 00  
C - fPublish (1 bit): 0  
D - fDialog (1 bit): 0  
E - fApplyStyles (1 bit): 0  
F - fRowSumsBelow (1 bit): 0  
G - fColSumsRight (1 bit): 1  
H - fFitToPage (1 bit): 1  
I - reserved2 (1 bit): 0  
J - fShowOutlineSymbols (1 bit): 0  
K - reserved3 (1 bit): 0  
L - fSyncHoriz (1 bit): 0  
M - fSyncVert (1 bit): 0  
N - fAltExprEval (1 bit): 0  
O - fAltFormulaEntry (1 bit): 0  
P - fFilterMode (1 bit): 0  
Q - fCondFmtCalc (1 bit): 0  
reserved4 (6 bits): 000000  
brtcolorTab (8 bytes): 1100100110000000110001001001001100100000010000000000000000000010  
reserved (undocumented) (6 bytes): 000000000000000000000000000000000000000000000000  
rwSync (4 bytes): 11111111111111111111111111111111  
colSync (4 bytes): 11111111111111111111111111111111  
strName.cchCharacters (CodeName): 01100000000000000000000000000000 Payload: Sheet1
reserved (undocumented) (3 bytes): 001010011000000000001000  
brtWsDim.rwFirst (4 bytes): 00000000000000000000000000000000 IntVal: 0  
brtWsDim.rwLast (4 bytes): 01000000000000000000000000000000 IntVal: 2  
brtWsDim.colFirst (4 bytes): 00000000000000000000000000000000 IntVal: 0  
brtWsDim.colLast (4 bytes): 01000000000000000000000000000000 IntVal: 2  
'''

Looks like I missed the section in the spec that explains that each record begins with a header that gives a record type id and the size of the record in bytes. It was these bits that caused the field misalignment above that I mistook for undocumented fields. Here's my results after making the necessary modifications to account for the record headers:

All bits and bytes displayed little endian

Record Type (max 2 bytes): 10000001 10000000 Byte Count: 2 IntVal 129 Name BrtBeginSheet <--the 129 is the record type BrtBeginSheet is a lookup for the type name
Record Size in Bytes (max 4 bytes): 00000000 Byte Count: 1 IntVal 0 <--this is the size of the record in bytes
Record Type (max 2 bytes): 11001001 10000000 Byte Count: 2 IntVal 147 Name BrtWsProp
Record Size in Bytes (max 4 bytes): 11000100 Byte Count: 1 IntVal 35
A - fShowAutoBreaks (1 bit): 1 
B - reserved1 (2 bits): 00 
C - fPublish (1 bit): 1 
D - fDialog (1 bit): 0 
E - fApplyStyles (1 bit): 0 
F - fRowSumsBelow (1 bit): 1 
G - fColSumsRight (1 bit): 1 
H - fFitToPage (1 bit): 0 
I - reserved2 (1 bit): 0 
J - fShowOutlineSymbols (1 bit): 1 
K - reserved3 (1 bit): 0 
L - fSyncHoriz (1 bit): 0 
M - fSyncVert (1 bit): 0 
N - fAltExprEval (1 bit): 0 
O - fAltFormulaEntry (1 bit): 0 
P - fFilterMode (1 bit): 0 
Q - fCondFmtCalc (1 bit): 1 
reserved4 (6 bits): 000000 
brtcolorTab (8 bytes): 0000000000000010000000000000000000000000000000000000000000000000 
rwSync (4 bytes): 11111111111111111111111111111111 
colSync (4 bytes): 11111111111111111111111111111111 
strName.cchCharacters (CodeName): 01100000000000000000000000000000 payload: Sheet1
Next Byte: 41.0
Next Byte: 41
Record Type (max 2 bytes): 00101001 10000000 Byte Count: 2 IntVal 148 Name BrtWsDim
Record Size in Bytes (max 4 bytes): 00001000 Byte Count: 1 IntVal 16
brtWsDim.rwFirst (4 bytes): 00000000000000000000000000000000 IntVal: 0 
brtWsDim.rwLast (4 bytes): 11000000000000000000000000000000 IntVal: 3 <-- modified the file so it's a little bigger
brtWsDim.colFirst (4 bytes): 00000000000000000000000000000000 IntVal: 0 
brtWsDim.colLast (4 bytes): 11000000000000000000000000000000 IntVal: 3 <-- modified the file so it's a little bigger
Record Type (max 2 bytes): 10100001 10000000 Byte Count: 2 IntVal 133 Name BrtBeginWsViews
Record Size in Bytes (max 4 bytes): 00000000 Byte Count: 1 IntVal 0

Hope this is of useful to someone besides me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM