fpspreadsheet: Add some more record descriptions to BIFFExplorer

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2987 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-05-02 14:55:23 +00:00
parent 0bff229235
commit 5325f81daf
5 changed files with 547 additions and 253 deletions

View File

@ -154,7 +154,7 @@
<Unit3> <Unit3>
<Filename Value="bebiffutils.pas"/> <Filename Value="bebiffutils.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="bebiffutils"/> <UnitName Value="beBIFFUtils"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
<Filename Value="behtml.pas"/> <Filename Value="behtml.pas"/>

View File

@ -24,6 +24,7 @@ type
function GetStringType: String; function GetStringType: String;
procedure ShowBackup; procedure ShowBackup;
procedure ShowBlankCell;
procedure ShowBOF; procedure ShowBOF;
procedure ShowBookBool; procedure ShowBookBool;
procedure ShowBottomMargin; procedure ShowBottomMargin;
@ -221,6 +222,8 @@ begin
case FRecType of case FRecType of
$0000, $0200: $0000, $0200:
ShowDimensions; ShowDimensions;
$0001, $0201:
ShowBlankCell;
$0002: $0002:
ShowInteger; ShowInteger;
$0003, $0203: $0003, $0203:
@ -397,6 +400,86 @@ begin
end; end;
procedure TBIFFGrid.ShowBlankCell;
var
numBytes: Integer;
b: Byte = 0;
w: Word = 0;
dbl: Double;
begin
RowCount := IfThen(FFormat = sfExcel2, FixedRows + 5, FixedRows + 3);
// Offset 0: Row & Offset 2: Column
ShowRowColData(FBufferIndex);
// Offset 4: Cell attributes (BIFF2) or XF record index (> BIFF2)
if FFormat = sfExcel2 then begin
numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Cell protection and XF index:'#13);
FDetails.Add(Format('Bits 5-0 = %d: XF Index', [b and $3F]));
case b and $40 of
0: FDetails.Add('Bit 6 = 0: Cell is NOT locked.');
1: FDetails.Add('Bit 6 = 1: Cell is locked.');
end;
case b and $80 of
0: FDetails.Add('Bit 7 = 0: Formula is NOT hidden.');
1: FDetails.Add('Bit 7 = 1: Formula is hidden.');
end;
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b, b]),
'Cell protection and XF index');
numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Indexes to format and font records:'#13);
FDetails.Add(Format('Bits 5-0 = %d: Index to FORMAT record', [b and $3f]));
FDetails.Add(Format('Bits 7-6 = %d: Index to FONT record', [(b and $C0) shr 6]));
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b, b]),
'Indexes of format and font records');
numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Cell style:'#13);
case b and $07 of
0: FDetails.Add('Bits 2-0 = 0: Horizontal alignment is GENERAL');
1: FDetails.Add('Bits 2-0 = 1: Horizontal alignment is LEFT');
2: FDetails.Add('Bits 2-0 = 2: Horizontal alignment is CENTERED');
3: FDetails.Add('Bits 2-0 = 3: Horizontal alignment is RIGHT');
4: FDetails.Add('Bits 2-0 = 4: Horizontal alignment is FILLED');
end;
if b and $08 = 0
then FDetails.Add('Bit 3 = 0: Cell has NO left border')
else FDetails.Add('Bit 3 = 1: Cell has left black border');
if b and $10 = 0
then FDetails.Add('Bit 4 = 0: Cell has NO right border')
else FDetails.Add('Bit 4 = 1: Cell has right black border');
if b and $20 = 0
then FDetails.Add('Bit 5 = 0: Cell has NO top border')
else FDetails.Add('Bit 5 = 1: Cell has top black border');
if b and $40 = 0
then FDetails.Add('Bit 6 = 0: Cell has NO bottom border')
else FDetails.Add('Bit 6 = 1: Cell has bottom black border');
if b and $80 = 0
then FDetails.Add('Bit 7 = 0: Cell has NO shaded background')
else FDetails.Add('Bit 7 = 1: Cell has shaded background');
end;
ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]),
'Cell style');
end else
begin
numBytes := 2;
Move(FBuffer[FBufferIndex], w, numBytes);
w := WordLEToN(w);
ShowInRow(FCurrROw, FBufferIndex, numBytes, Format('%d ($%.4x)', [w, w]),
'Index of XF record');
end;
end;
procedure TBIFFGrid.ShowBOF; procedure TBIFFGrid.ShowBOF;
var var
numBytes: Integer; numBytes: Integer;
@ -1162,16 +1245,58 @@ begin
if FFormat = sfExcel2 then begin if FFormat = sfExcel2 then begin
numBytes := 1; numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes); Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Cell protection and XF index:'#13);
FDetails.Add(Format('Bits 5-0 = %d: XF Index', [b and $3F]));
case b and $40 of
0: FDetails.Add('Bit 6 = 0: Cell is NOT locked.');
1: FDetails.Add('Bit 6 = 1: Cell is locked.');
end;
case b and $80 of
0: FDetails.Add('Bit 7 = 0: Formula is NOT hidden.');
1: FDetails.Add('Bit 7 = 1: Formula is hidden.');
end;
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]),
'Cell protection and XF index'); 'Cell protection and XF index');
numBytes := 1; numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes); Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Indexes to format and font records:'#13);
FDetails.Add(Format('Bits 5-0 = %d: Index to FORMAT record', [b and $3f]));
FDetails.Add(Format('Bits 7-6 = %d: Index to FONT record', [(b and $C0) shr 6]));
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]),
'Indexes of format and font records'); 'Indexes of format and font records');
numBytes := 1; numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes); Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Cell style:'#13);
case b and $07 of
0: FDetails.Add('Bits 2-0 = 0: Horizontal alignment is GENERAL');
1: FDetails.Add('Bits 2-0 = 1: Horizontal alignment is LEFT');
2: FDetails.Add('Bits 2-0 = 2: Horizontal alignment is CENTERED');
3: FDetails.Add('Bits 2-0 = 3: Horizontal alignment is RIGHT');
4: FDetails.Add('Bits 2-0 = 4: Horizontal alignment is FILLED');
end;
if b and $08 = 0
then FDetails.Add('Bit 3 = 0: Cell has NO left border')
else FDetails.Add('Bit 3 = 1: Cell has left black border');
if b and $10 = 0
then FDetails.Add('Bit 4 = 0: Cell has NO right border')
else FDetails.Add('Bit 4 = 1: Cell has right black border');
if b and $20 = 0
then FDetails.Add('Bit 5 = 0: Cell has NO top border')
else FDetails.Add('Bit 5 = 1: Cell has top black border');
if b and $40 = 0
then FDetails.Add('Bit 6 = 0: Cell has NO bottom border')
else FDetails.Add('Bit 6 = 1: Cell has bottom black border');
if b and $80 = 0
then FDetails.Add('Bit 7 = 0: Cell has NO shaded background')
else FDetails.Add('Bit 7 = 1: Cell has shaded background');
end;
ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]),
'Cell style'); 'Cell style');
end else begin end else begin
@ -1692,12 +1817,56 @@ begin
numBytes := 1; numBytes := 1;
b := FBuffer[FBufferIndex]; b := FBuffer[FBufferIndex];
if Row = FCurrRow then begin
FDetails.Add('Cell protection and XF index:'#13);
FDetails.Add(Format('Bits 5-0 = %d: XF Index', [b and $3F]));
case b and $40 of
0: FDetails.Add('Bit 6 = 0: Cell is NOT locked.');
1: FDetails.Add('Bit 6 = 1: Cell is locked.');
end;
case b and $80 of
0: FDetails.Add('Bit 7 = 0: Formula is NOT hidden.');
1: FDetails.Add('Bit 7 = 1: Formula is hidden.');
end;
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]),
'Cell protection and XF index'); 'Cell protection and XF index');
b := FBuffer[FBufferIndex]; b := FBuffer[FBufferIndex];
if Row = FCurrRow then begin
FDetails.Add('Indexes to format and font records:'#13);
FDetails.Add(Format('Bits 5-0 = %d: Index to FORMAT record', [b and $3f]));
FDetails.Add(Format('Bits 7-6 = %d: Index to FONT record', [(b and $C0) shr 6]));
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]),
'Indexes of format and font records'); 'Indexes of format and font records');
b := FBuffer[FBufferIndex]; b := FBuffer[FBufferIndex];
if Row = FCurrRow then begin
FDetails.Add('Cell style:'#13);
case b and $07 of
0: FDetails.Add('Bits 2-0 = 0: Horizontal alignment is GENERAL');
1: FDetails.Add('Bits 2-0 = 1: Horizontal alignment is LEFT');
2: FDetails.Add('Bits 2-0 = 2: Horizontal alignment is CENTERED');
3: FDetails.Add('Bits 2-0 = 3: Horizontal alignment is RIGHT');
4: FDetails.Add('Bits 2-0 = 4: Horizontal alignment is FILLED');
end;
if b and $08 = 0
then FDetails.Add('Bit 3 = 0: Cell has NO left border')
else FDetails.Add('Bit 3 = 1: Cell has left black border');
if b and $10 = 0
then FDetails.Add('Bit 4 = 0: Cell has NO right border')
else FDetails.Add('Bit 4 = 1: Cell has right black border');
if b and $20 = 0
then FDetails.Add('Bit 5 = 0: Cell has NO top border')
else FDetails.Add('Bit 5 = 1: Cell has top black border');
if b and $40 = 0
then FDetails.Add('Bit 6 = 0: Cell has NO bottom border')
else FDetails.Add('Bit 6 = 1: Cell has bottom black border');
if b and $80 = 0
then FDetails.Add('Bit 7 = 0: Cell has NO shaded background')
else FDetails.Add('Bit 7 = 1: Cell has shaded background');
end;
ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]),
'Cell style'); 'Cell style');
@ -1765,16 +1934,58 @@ begin
if (FFormat = sfExcel2) then begin if (FFormat = sfExcel2) then begin
numBytes := 1; numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes); Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Cell protection and XF index:'#13);
FDetails.Add(Format('Bits 5-0 = %d: XF Index', [b and $3F]));
case b and $40 of
0: FDetails.Add('Bit 6 = 0: Cell is NOT locked.');
1: FDetails.Add('Bit 6 = 1: Cell is locked.');
end;
case b and $80 of
0: FDetails.Add('Bit 7 = 0: Formula is NOT hidden.');
1: FDetails.Add('Bit 7 = 1: Formula is hidden.');
end;
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]),
'Cell protection and XF index'); 'Cell protection and XF index');
numBytes := 1; numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes); Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Indexes to format and font records:'#13);
FDetails.Add(Format('Bits 5-0 = %d: Index to FORMAT record', [b and $3f]));
FDetails.Add(Format('Bits 7-6 = %d: Index to FONT record', [(b and $C0) shr 6]));
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]),
'Indexes of format and font records'); 'Indexes of format and font records');
numBytes := 1; numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes); Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Cell style:'#13);
case b and $07 of
0: FDetails.Add('Bits 2-0 = 0: Horizontal alignment is GENERAL');
1: FDetails.Add('Bits 2-0 = 1: Horizontal alignment is LEFT');
2: FDetails.Add('Bits 2-0 = 2: Horizontal alignment is CENTERED');
3: FDetails.Add('Bits 2-0 = 3: Horizontal alignment is RIGHT');
4: FDetails.Add('Bits 2-0 = 4: Horizontal alignment is FILLED');
end;
if b and $08 = 0
then FDetails.Add('Bit 3 = 0: Cell has NO left border')
else FDetails.Add('Bit 3 = 1: Cell has left black border');
if b and $10 = 0
then FDetails.Add('Bit 4 = 0: Cell has NO right border')
else FDetails.Add('Bit 4 = 1: Cell has right black border');
if b and $20 = 0
then FDetails.Add('Bit 5 = 0: Cell has NO top border')
else FDetails.Add('Bit 5 = 1: Cell has top black border');
if b and $40 = 0
then FDetails.Add('Bit 6 = 0: Cell has NO bottom border')
else FDetails.Add('Bit 6 = 1: Cell has bottom black border');
if b and $80 = 0
then FDetails.Add('Bit 7 = 0: Cell has NO shaded background')
else FDetails.Add('Bit 7 = 1: Cell has shaded background');
end;
ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]),
'Cell style'); 'Cell style');
end else begin end else begin
@ -1908,16 +2119,58 @@ begin
if FFormat = sfExcel2 then begin if FFormat = sfExcel2 then begin
numBytes := 1; numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes); Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Cell protection and XF index:'#13);
FDetails.Add(Format('Bits 5-0 = %d: XF Index', [b and $3F]));
case b and $40 of
0: FDetails.Add('Bit 6 = 0: Cell is NOT locked.');
1: FDetails.Add('Bit 6 = 1: Cell is locked.');
end;
case b and $80 of
0: FDetails.Add('Bit 7 = 0: Formula is NOT hidden.');
1: FDetails.Add('Bit 7 = 1: Formula is hidden.');
end;
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]),
'Cell protection and XF index'); 'Cell protection and XF index');
numBytes := 1; numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes); Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Indexes to format and font records:'#13);
FDetails.Add(Format('Bits 5-0 = %d: Index to FORMAT record', [b and $3f]));
FDetails.Add(Format('Bits 7-6 = %d: Index to FONT record', [(b and $C0) shr 6]));
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]),
'Indexes of format and font records'); 'Indexes of format and font records');
numBytes := 1; numBytes := 1;
Move(FBuffer[FBufferIndex], b, numBytes); Move(FBuffer[FBufferIndex], b, numBytes);
if Row = FCurrRow then begin
FDetails.Add('Cell style:'#13);
case b and $07 of
0: FDetails.Add('Bits 2-0 = 0: Horizontal alignment is GENERAL');
1: FDetails.Add('Bits 2-0 = 1: Horizontal alignment is LEFT');
2: FDetails.Add('Bits 2-0 = 2: Horizontal alignment is CENTERED');
3: FDetails.Add('Bits 2-0 = 3: Horizontal alignment is RIGHT');
4: FDetails.Add('Bits 2-0 = 4: Horizontal alignment is FILLED');
end;
if b and $08 = 0
then FDetails.Add('Bit 3 = 0: Cell has NO left border')
else FDetails.Add('Bit 3 = 1: Cell has left black border');
if b and $10 = 0
then FDetails.Add('Bit 4 = 0: Cell has NO right border')
else FDetails.Add('Bit 4 = 1: Cell has right black border');
if b and $20 = 0
then FDetails.Add('Bit 5 = 0: Cell has NO top border')
else FDetails.Add('Bit 5 = 1: Cell has top black border');
if b and $40 = 0
then FDetails.Add('Bit 6 = 0: Cell has NO bottom border')
else FDetails.Add('Bit 6 = 1: Cell has bottom black border');
if b and $80 = 0
then FDetails.Add('Bit 7 = 0: Cell has NO shaded background')
else FDetails.Add('Bit 7 = 1: Cell has shaded background');
end;
ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]), ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]),
'Cell style'); 'Cell style');
end else begin end else begin
@ -3052,7 +3305,7 @@ begin
then FDetails.Add('Bit 7 = 0: Formula is not hidden') then FDetails.Add('Bit 7 = 0: Formula is not hidden')
else FDetails.Add('Bit 7 = 1: Formula is hidden'); else FDetails.Add('Bit 7 = 1: Formula is hidden');
end; end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [b]), ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b, b]),
'Number format and cell flags'); 'Number format and cell flags');
b := FBuffer[FBufferIndex]; b := FBuffer[FBufferIndex];

View File

@ -90,18 +90,18 @@ end;
function RecTypeName(ARecType: Word): String; function RecTypeName(ARecType: Word): String;
begin begin
case ARecType of case ARecType of
$0000: Result := 'Dimension'; $0000: Result := 'DIMENSION';
$0001: Result := 'Blank'; $0001: Result := 'BLANK';
$0002: Result := 'Integer'; $0002: Result := 'INTEGER';
$0003: Result := 'Number'; $0003: Result := 'NUMBER';
$0004: Result := 'Label'; $0004: Result := 'LABEL';
$0005: Result := 'BoolErr'; $0005: Result := 'BoolErr';
$0006: Result := 'Formula'; $0006: Result := 'FORMULA';
$0007: Result := 'String'; $0007: Result := 'STRING';
$0008: Result := 'Row'; $0008: Result := 'ROW';
$0009: Result := 'BOF'; $0009: Result := 'BOF';
$000A: Result := 'EOF: End of file'; $000A: Result := 'EOF: End of file';
$000B: Result := 'Index'; $000B: Result := 'INDEX';
$000C: Result := 'CALCCOUNT: Iteration count'; $000C: Result := 'CALCCOUNT: Iteration count';
$000D: Result := 'CALCMODE: Calculation mode'; $000D: Result := 'CALCMODE: Calculation mode';
$000E: Result := 'PRECISION: Precision'; $000E: Result := 'PRECISION: Precision';
@ -119,14 +119,14 @@ begin
$001A: Result := 'VERTICALPAGEBREAKS: Explicit column page breaks'; $001A: Result := 'VERTICALPAGEBREAKS: Explicit column page breaks';
$001B: Result := 'HORIZONALPAGEBREAKS: Explicit row page breaks'; $001B: Result := 'HORIZONALPAGEBREAKS: Explicit row page breaks';
$001C: Result := 'NOTE: Comment associated with a cell'; $001C: Result := 'NOTE: Comment associated with a cell';
$001D: Result := 'SELECTION: current selection'; $001D: Result := 'SELECTION: Current selection';
$001E: Result := 'Format'; $001E: Result := 'FORMAT: Number format record';
$001F: Result := 'BuiltInFmtCount'; $001F: Result := 'FORMATCOUNT: Count of number formats';
$0020: Result := 'ColumnDefault'; $0020: Result := 'ColumnDefault';
$0021: Result := 'Array'; $0021: Result := 'Array';
$0022: Result := '1904: 1904 date system'; $0022: Result := '1904: 1904 date system';
$0023: Result := 'ExternalName'; $0023: Result := 'ExternalName';
$0024: Result := 'ColWidth'; $0024: Result := 'COLWIDTH';
$0025: Result := 'DefaultRowHeight'; $0025: Result := 'DefaultRowHeight';
$0026: Result := 'LEFTMARGIN: Left margin measurement'; $0026: Result := 'LEFTMARGIN: Left margin measurement';
$0027: Result := 'RIGHTMARGIN: Right margin measurement'; $0027: Result := 'RIGHTMARGIN: Right margin measurement';
@ -136,19 +136,19 @@ begin
$002B: Result := 'PRINTGRIDLINES: Print gridlines flag'; $002B: Result := 'PRINTGRIDLINES: Print gridlines flag';
$002F: Result := 'FILEPASS: File is password-protected'; $002F: Result := 'FILEPASS: File is password-protected';
$0031: Result := 'FONT: Font and font formatting information'; $0031: Result := 'FONT: Font and font formatting information';
$0032: Result := 'Font2'; $0032: Result := 'FONT2';
$0033: Result := 'PRINTSIZE: Printed size of chart'; $0033: Result := 'PRINTSIZE: Printed size of chart';
$0036: Result := 'DataTable'; $0036: Result := 'DataTable';
$0037: Result := 'DateTable2'; $0037: Result := 'DateTable2';
$003C: Result := 'CONTINUE: Continues long records'; $003C: Result := 'CONTINUE: Continues long records';
$003D: Result := 'WINDOW1: Window information'; $003D: Result := 'WINDOW1: Window information';
$003E: Result := 'Window2'; $003E: Result := 'WINDOW2';
$0040: Result := 'BACKUP: Save backup version of the file'; $0040: Result := 'BACKUP: Save backup version of the file';
$0041: Result := 'PANE: Number of panes and their position'; $0041: Result := 'PANE: Number of panes and their position';
$0042: Result := 'CODEPAGE: Default code page'; // also: CODENAME: VBE object name ??? $0042: Result := 'CODEPAGE: Default code page'; // also: CODENAME: VBE object name ???
$0043: Result := 'XF: Extended f'; $0043: Result := 'XF: Extended format';
$0044: Result := 'IXFE'; $0044: Result := 'IXFE';
$0045: Result := 'FontColor'; $0045: Result := 'FONTCOLOR';
$004D: Result := 'PLS: Environment-specific print record'; $004D: Result := 'PLS: Environment-specific print record';
$0050: Result := 'DCON: Data consolidation information'; $0050: Result := 'DCON: Data consolidation information';
$0051: Result := 'DCONREF: Data consolidation references'; $0051: Result := 'DCONREF: Data consolidation references';
@ -287,7 +287,7 @@ begin
$0231: Result := 'FONT: Font description'; $0231: Result := 'FONT: Font description';
$0236: Result := 'TABLE: Data table'; $0236: Result := 'TABLE: Data table';
$023E: Result := 'WINDOW2: Sheet window information'; $023E: Result := 'WINDOW2: Sheet window information';
$0243: Result := 'XF'; $0243: Result := 'XF: Extended format';
$027E: Result := 'RK'; $027E: Result := 'RK';
$0293: Result := 'STYLE: Style information'; $0293: Result := 'STYLE: Style information';
$0406: Result := 'FORMULA: Cell formula'; $0406: Result := 'FORMULA: Cell formula';

View File

@ -62,30 +62,97 @@ object MainForm: TMainForm
ClientHeight = 507 ClientHeight = 507
ClientWidth = 665 ClientWidth = 665
TabOrder = 2 TabOrder = 2
object HexSplitter: TSplitter object PageControl: TPageControl
Left = 0
Height = 507
Top = 0
Width = 665
ActivePage = PgValues
Align = alClient
TabIndex = 1
TabOrder = 0
OnChange = PageControlChange
object PgAnalysis: TTabSheet
Caption = 'Analysis'
ClientHeight = 479
ClientWidth = 657
object AnalysisDetails: TMemo
Left = 0
Height = 191
Top = 288
Width = 657
Align = alBottom
Font.CharSet = ANSI_CHARSET
Font.Height = -12
Font.Name = 'Courier New'
Font.Pitch = fpFixed
Font.Quality = fqDraft
ParentFont = False
ScrollBars = ssAutoBoth
TabOrder = 0
WordWrap = False
end
object DetailsSplitter: TSplitter
Cursor = crVSplit Cursor = crVSplit
Left = 0 Left = 0
Height = 5 Height = 5
Top = 244 Top = 283
Width = 665 Width = 657
Align = alBottom Align = alBottom
ResizeAnchor = akBottom ResizeAnchor = akBottom
end end
end
object PgValues: TTabSheet
Caption = 'Values'
ClientHeight = 479
ClientWidth = 657
object ValueGrid: TStringGrid
Left = 0
Height = 158
Top = 321
Width = 657
Align = alBottom
ColCount = 3
DefaultColWidth = 100
FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goColSizing, goSmoothScroll]
RowCount = 9
TabOrder = 0
TitleStyle = tsNative
OnPrepareCanvas = ValueGridPrepareCanvas
ColWidths = (
112
142
141
)
Cells = (
3
0
0
'Data type'
1
0
'Value'
2
0
'Offset range'
)
end
object HexPanel: TPanel object HexPanel: TPanel
Left = 0 Left = 0
Height = 244 Height = 316
Top = 0 Top = 0
Width = 665 Width = 657
Align = alClient Align = alClient
Caption = 'HexPanel' Caption = 'HexPanel'
ClientHeight = 244 ClientHeight = 316
ClientWidth = 665 ClientWidth = 657
TabOrder = 1 TabOrder = 1
object HexGrid: TStringGrid object HexGrid: TStringGrid
Left = 1 Left = 1
Height = 242 Height = 314
Top = 1 Top = 1
Width = 398 Width = 390
Align = alClient Align = alClient
AutoFillColumns = True AutoFillColumns = True
ColCount = 17 ColCount = 17
@ -115,7 +182,7 @@ object MainForm: TMainForm
22 22
22 22
22 22
36 28
) )
Cells = ( Cells = (
16 16
@ -170,8 +237,8 @@ object MainForm: TMainForm
) )
end end
object AlphaGrid: TStringGrid object AlphaGrid: TStringGrid
Left = 404 Left = 396
Height = 242 Height = 314
Top = 1 Top = 1
Width = 260 Width = 260
Align = alRight Align = alRight
@ -255,88 +322,22 @@ object MainForm: TMainForm
) )
end end
object HexDumpSplitter: TSplitter object HexDumpSplitter: TSplitter
Left = 399 Left = 391
Height = 242 Height = 314
Top = 1 Top = 1
Width = 5 Width = 5
Align = alRight Align = alRight
ResizeAnchor = akRight ResizeAnchor = akRight
end end
end end
object PageControl: TPageControl object HexSplitter: TSplitter
Cursor = crVSplit
Left = 0 Left = 0
Height = 258 Height = 5
Top = 249 Top = 316
Width = 665
ActivePage = PgValues
Align = alBottom
TabIndex = 1
TabOrder = 2
OnChange = PageControlChange
object PgAnalysis: TTabSheet
Caption = 'Analysis'
ClientHeight = 225
ClientWidth = 657
object AnalysisDetails: TMemo
Left = 428
Height = 225
Top = 0
Width = 229
Align = alRight
Font.CharSet = ANSI_CHARSET
Font.Height = -12
Font.Name = 'Courier New'
Font.Pitch = fpFixed
Font.Quality = fqDraft
ParentFont = False
ScrollBars = ssAutoBoth
TabOrder = 0
WordWrap = False
end
object DetailsSplitter: TSplitter
Left = 423
Height = 225
Top = 0
Width = 5
Align = alRight
ResizeAnchor = akRight
end
end
object PgValues: TTabSheet
Caption = 'Values'
ClientHeight = 230
ClientWidth = 657
object ValueGrid: TStringGrid
Left = 0
Height = 230
Top = 0
Width = 657 Width = 657
Align = alClient Align = alBottom
ColCount = 3 ResizeAnchor = akBottom
DefaultColWidth = 100
FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goColSizing, goSmoothScroll]
RowCount = 9
TabOrder = 0
TitleStyle = tsNative
OnPrepareCanvas = ValueGridPrepareCanvas
ColWidths = (
112
142
141
)
Cells = (
3
0
0
'Data type'
1
0
'Value'
2
0
'Offset range'
)
end end
end end
end end
@ -514,7 +515,7 @@ object MainForm: TMainForm
Align = alClient Align = alClient
ButtonStyle = bsTriangle ButtonStyle = bsTriangle
DefaultText = 'Node' DefaultText = 'Node'
Header.AutoSizeIndex = 3 Header.AutoSizeIndex = 4
Header.Columns = < Header.Columns = <
item item
Alignment = taRightJustify Alignment = taRightJustify
@ -539,10 +540,16 @@ object MainForm: TMainForm
Width = 130 Width = 130
end end
item item
MinWidth = 80 Alignment = taCenter
MinWidth = 50
Position = 3 Position = 3
Text = 'Index'
end
item
MinWidth = 80
Position = 4
Text = 'Record description' Text = 'Record description'
Width = 125 Width = 80
end> end>
Header.DefaultHeight = 24 Header.DefaultHeight = 24
Header.Font.Style = [fsBold] Header.Font.Style = [fsBold]

View File

@ -22,6 +22,7 @@ type
RecordID: Integer; RecordID: Integer;
RecordName: String; RecordName: String;
RecordDescription: String; RecordDescription: String;
Index: Integer;
destructor Destroy; override; destructor Destroy; override;
end; end;
@ -131,6 +132,10 @@ type
FFormat: TsSpreadsheetFormat; FFormat: TsSpreadsheetFormat;
FBuffer: TBIFFBuffer; FBuffer: TBIFFBuffer;
FCurrOffset: Integer; FCurrOffset: Integer;
FXFIndex: Integer;
FFontIndex: Integer;
FFormatIndex: Integer;
FRowIndex: Integer;
FLockHexDumpGrids: Integer; FLockHexDumpGrids: Integer;
FAnalysisGrid: TBIFFGrid; FAnalysisGrid: TBIFFGrid;
FMRUMenuManager : TMRUMenuManager; FMRUMenuManager : TMRUMenuManager;
@ -446,7 +451,8 @@ begin
0: CellText := IntToStr(data.Offset); 0: CellText := IntToStr(data.Offset);
1: CellText := Format('$%.4x', [data.RecordID]); 1: CellText := Format('$%.4x', [data.RecordID]);
2: CellText := data.RecordName; 2: CellText := data.RecordName;
3: CellText := data.RecordDescription; 3: if data.Index > -1 then CellText := IntToStr(data.Index);
4: CellText := data.RecordDescription;
end; end;
end; end;
end; end;
@ -589,6 +595,11 @@ begin
OnRecentFile := @MRUMenuManagerRecentFile; OnRecentFile := @MRUMenuManagerRecentFile;
end; end;
FXFIndex := -1;
FFontIndex := -1;
FFormatIndex := -1;
FRowIndex := -1;
HexGrid.ColWidths[HexGrid.ColCount-1] := 5; HexGrid.ColWidths[HexGrid.ColCount-1] := 5;
HexGrid.DefaultRowHeight := HexGrid.Canvas.TextHeight('Tg') + 4; HexGrid.DefaultRowHeight := HexGrid.Canvas.TextHeight('Tg') + 4;
AlphaGrid.DefaultRowHeight := HexGrid.DefaultRowHeight; AlphaGrid.DefaultRowHeight := HexGrid.DefaultRowHeight;
@ -1000,7 +1011,7 @@ begin
try try
ReadFormFromIni(ini, 'MainForm', self); ReadFormFromIni(ini, 'MainForm', self);
BiffTree.Width := ini.ReadInteger('MainForm', 'RecordList_Width', BiffTree.Width); TreePanel.Width := ini.ReadInteger('MainForm', 'RecordList_Width', TreePanel.Width);
for i:=0 to BiffTree.Header.Columns.Count-1 do for i:=0 to BiffTree.Header.Columns.Count-1 do
BiffTree.Header.Columns[i].Width := ini.ReadInteger('MainForm', BiffTree.Header.Columns[i].Width := ini.ReadInteger('MainForm',
Format('RecordList_ColWidth_%d', [i+1]), BiffTree.Header.Columns[i].Width); Format('RecordList_ColWidth_%d', [i+1]), BiffTree.Header.Columns[i].Width);
@ -1010,7 +1021,7 @@ begin
ValueGrid.ColWidths[i] := ini.ReadInteger('MainForm', ValueGrid.ColWidths[i] := ini.ReadInteger('MainForm',
Format('ValueGrid_ColWidth_%d', [i+1]), ValueGrid.ColWidths[i]); Format('ValueGrid_ColWidth_%d', [i+1]), ValueGrid.ColWidths[i]);
AlphaGrid.Width := ini.ReadInteger('MainForm', 'AlphaGrid_Width', AlphaGrid.Width); AlphaGrid.Height := ini.ReadInteger('MainForm', 'AlphaGrid_Height', AlphaGrid.Height);
for i:=0 to AlphaGrid.ColCount-1 do for i:=0 to AlphaGrid.ColCount-1 do
AlphaGrid.ColWidths[i] := ini.ReadInteger('MainForm', AlphaGrid.ColWidths[i] := ini.ReadInteger('MainForm',
Format('AlphaGrid_ColWidth_%d', [i+1]), AlphaGrid.ColWidths[i]); Format('AlphaGrid_ColWidth_%d', [i+1]), AlphaGrid.ColWidths[i]);
@ -1019,9 +1030,8 @@ begin
FAnalysisGrid.ColWidths[i] := ini.ReadInteger('MainForm', FAnalysisGrid.ColWidths[i] := ini.ReadInteger('MainForm',
Format('AnalysisGrid_ColWidth_%d', [i+1]), FAnalysisGrid.ColWidths[i]); Format('AnalysisGrid_ColWidth_%d', [i+1]), FAnalysisGrid.ColWidths[i]);
AnalysisDetails.Width := ini.ReadInteger('MainForm', 'AnalysisDetails_Width', AnalysisDetails.Width); AnalysisDetails.Height := ini.ReadInteger('MainForm', 'AnalysisDetails_Height', AnalysisDetails.Height);
PageControl.Height := ini.ReadInteger('MainForm', 'PageControl_Height', PageControl.Height);
PageControl.ActivePageIndex := ini.ReadInteger('MainForm', 'PageIndex', PageControl.ActivePageIndex); PageControl.ActivePageIndex := ini.ReadInteger('MainForm', 'PageIndex', PageControl.ActivePageIndex);
finally finally
ini.Free; ini.Free;
@ -1071,6 +1081,7 @@ begin
parentnode := BIFFTree.AddChild(nil); parentnode := BIFFTree.AddChild(nil);
ptr := BIFFTree.GetNodeData(parentnode); ptr := BIFFTree.GetNodeData(parentnode);
ptr^.Data := parentdata; ptr^.Data := parentdata;
FRowIndex := -1;
end; end;
// add node to parent node // add node to parent node
data := TBiffNodeData.Create; data := TBiffNodeData.Create;
@ -1083,6 +1094,30 @@ begin
data.RecordName := s; data.RecordName := s;
data.RecordDescription := ''; data.RecordDescription := '';
end; end;
case recType of
$0008, $0208: // Row
begin
inc(FRowIndex);
data.Index := FRowIndex;
end;
$0031, $0231: // Font record
begin
inc(FFontIndex);
data.Index := FFontIndex;
end;
$0043, $00E0: // XF record
begin
inc(FXFIndex);
data.Index := FXFIndex;
end;
$001E, $041E: // Format record
begin
inc(FFormatIndex);
data.Index := FFormatIndex;
end;
else
data.Index := -1;
end;
node := BIFFTree.AddChild(parentnode); node := BIFFTree.AddChild(parentnode);
ptr := BIFFTree.GetNodeData(node); ptr := BIFFTree.GetNodeData(node);
ptr^.Data := data; ptr^.Data := data;
@ -1143,7 +1178,7 @@ begin
try try
WriteFormToIni(ini, 'MainForm', self); WriteFormToIni(ini, 'MainForm', self);
ini.WriteInteger('MainForm', 'RecordList_Width', BiffTree.Width); ini.WriteInteger('MainForm', 'RecordList_Width', TreePanel.Width);
for i:=0 to BiffTree.Header.Columns.Count-1 do for i:=0 to BiffTree.Header.Columns.Count-1 do
ini.WriteInteger('MainForm', Format('RecordList_ColWidth_%d', [i+1]), BiffTree.Header.Columns[i].Width); ini.WriteInteger('MainForm', Format('RecordList_ColWidth_%d', [i+1]), BiffTree.Header.Columns[i].Width);
@ -1158,10 +1193,9 @@ begin
for i:=0 to FAnalysisGrid.ColCount-1 do for i:=0 to FAnalysisGrid.ColCount-1 do
ini.WriteInteger('MainForm', Format('AnalysisGrid_ColWidth_%d', [i+1]), FAnalysisGrid.ColWidths[i]); ini.WriteInteger('MainForm', Format('AnalysisGrid_ColWidth_%d', [i+1]), FAnalysisGrid.ColWidths[i]);
ini.WriteInteger('MainForm', 'AnalysisDetails_Width', AnalysisDetails.Width); ini.WriteInteger('MainForm', 'AnalysisDetails_Height', AnalysisDetails.Height);
ini.WriteInteger('MainForm', 'PageIndex', PageControl.ActivePageIndex); ini.WriteInteger('MainForm', 'PageIndex', PageControl.ActivePageIndex);
ini.WriteInteger('MainForm', 'PageControl_Height', PageControl.Height);
finally finally
ini.Free; ini.Free;
end; end;