You've already forked lazarus-ccr
fpspreadsheet: Fix endless loop in BIFFExplorer reading some files. Add info on FONTCOLOR record. Improve info on BOF record.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3012 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -46,6 +46,7 @@ type
|
|||||||
procedure ShowFileSharing;
|
procedure ShowFileSharing;
|
||||||
procedure ShowFnGroupCount;
|
procedure ShowFnGroupCount;
|
||||||
procedure ShowFont;
|
procedure ShowFont;
|
||||||
|
procedure ShowFontColor;
|
||||||
procedure ShowFooter;
|
procedure ShowFooter;
|
||||||
procedure ShowFormat;
|
procedure ShowFormat;
|
||||||
procedure ShowFormatCount;
|
procedure ShowFormatCount;
|
||||||
@ -304,6 +305,8 @@ begin
|
|||||||
ShowCodePage;
|
ShowCodePage;
|
||||||
$0043:
|
$0043:
|
||||||
ShowXF;
|
ShowXF;
|
||||||
|
$0045:
|
||||||
|
ShowFontColor;
|
||||||
$0055:
|
$0055:
|
||||||
ShowDefColWidth;
|
ShowDefColWidth;
|
||||||
$005B:
|
$005B:
|
||||||
@ -494,6 +497,7 @@ var
|
|||||||
begin
|
begin
|
||||||
case FFormat of
|
case FFormat of
|
||||||
sfExcel2: RowCount := FixedRows + 2;
|
sfExcel2: RowCount := FixedRows + 2;
|
||||||
|
sfExcel3, sfExcel4: RowCount := FixedRows + 3;
|
||||||
sfExcel5: RowCount := FixedRows + 4;
|
sfExcel5: RowCount := FixedRows + 4;
|
||||||
sfExcel8: RowCount := FixedRows + 6;
|
sfExcel8: RowCount := FixedRows + 6;
|
||||||
end;
|
end;
|
||||||
@ -503,17 +507,26 @@ begin
|
|||||||
w := WordLEToN(w);
|
w := WordLEToN(w);
|
||||||
if Row = FCurrRow then begin
|
if Row = FCurrRow then begin
|
||||||
FDetails.Add('BIFF version:'#13);
|
FDetails.Add('BIFF version:'#13);
|
||||||
case w of
|
case FRecType of
|
||||||
$0000: FDetails.Add('$0000 = BIFF5');
|
$0009,
|
||||||
$0200: FDetails.Add('$0200 = BIFF2');
|
$0209,
|
||||||
$0300: FDetails.Add('$0300 = BIFF3');
|
$0409: FDetails.Add('not used');
|
||||||
$0400: FDetails.Add('$0400 = BIFF4');
|
$0809: case FFormat of
|
||||||
$0500: FDetails.Add('$0500 = BIFF5');
|
sfExcel5: FDetails.Add('$0500 = BIFF5');
|
||||||
$0600: FDetails.Add('$0600 = BIFF8');
|
sfExcel8: FDetails.Add('$0600 = BIFF8');
|
||||||
|
end;
|
||||||
|
else case w of
|
||||||
|
$0000: FDetails.Add('$0000 = BIFF5');
|
||||||
|
$0200: FDetails.Add('$0200 = BIFF2');
|
||||||
|
$0300: FDetails.Add('$0300 = BIFF3');
|
||||||
|
$0400: FDetails.Add('$0400 = BIFF4');
|
||||||
|
$0500: FDetails.Add('$0500 = BIFF5');
|
||||||
|
$0600: FDetails.Add('$0600 = BIFF8');
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [w]),
|
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [w]),
|
||||||
'BIFF version ($0500=BIFF5, $0600=BIFF8)');
|
'BIFF version');
|
||||||
|
|
||||||
numBytes := 2;
|
numBytes := 2;
|
||||||
Move(FBuffer[FBufferIndex], w, numBytes);
|
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||||
@ -531,13 +544,18 @@ begin
|
|||||||
if FFormat > sfExcel2 then begin
|
if FFormat > sfExcel2 then begin
|
||||||
numBytes := 2;
|
numBytes := 2;
|
||||||
Move(FBuffer[FBufferIndex], w, numBytes);
|
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)),
|
if FFormat in [sfExcel3, sfExcel4] then
|
||||||
'Build identifier (must not be zero)');
|
ShowInRow(FCurrRow, FBUfferIndex, numBytes, IntToStr(WordLEToN(w)),
|
||||||
|
'not used')
|
||||||
|
else begin
|
||||||
|
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)),
|
||||||
|
'Build identifier (must not be zero)');
|
||||||
|
|
||||||
numBytes := 2;
|
numBytes := 2;
|
||||||
Move(FBuffer[FBufferIndex], w, numBytes);
|
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)),
|
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)),
|
||||||
'Build year (must not be zero)');
|
'Build year (must not be zero)');
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if FFormat = sfExcel8 then begin
|
if FFormat = sfExcel8 then begin
|
||||||
@ -1187,6 +1205,31 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TBIFFGrid.ShowFontColor;
|
||||||
|
var
|
||||||
|
numBytes: Integer;
|
||||||
|
w: Word;
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
RowCount := FixedRows + 1;
|
||||||
|
NumBytes := 2;
|
||||||
|
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||||
|
w := WordLEToN(w);
|
||||||
|
case w of
|
||||||
|
$0000: s := 'EGA Black (rgb = $000000)';
|
||||||
|
$0001: s := 'EGA White (rgb = $FFFFFF)';
|
||||||
|
$0002: s := 'EGA Red (rgb = $0000FF)';
|
||||||
|
$0003: s := 'EGA Green (rgb = $00FF00)';
|
||||||
|
$0004: s := 'EGA Blue (rgb = $FF0000)';
|
||||||
|
$0005: s := 'EGA Yellow (rgb = $00FFFF)';
|
||||||
|
$0006: s := 'EGA Magenta (rgb = $FF00FF)';
|
||||||
|
$0007: s := 'EGA Cyan (rgb = $FFFF00)';
|
||||||
|
$7FFF: s := 'Automatic (system window text colour)';
|
||||||
|
end;
|
||||||
|
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.04x)', [w, w]),
|
||||||
|
Format('Font color index into preceding FONT record (%s)', [s]));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBIFFGrid.ShowFooter;
|
procedure TBIFFGrid.ShowFooter;
|
||||||
var
|
var
|
||||||
numbytes: Integer;
|
numbytes: Integer;
|
||||||
|
@ -1062,6 +1062,8 @@ begin
|
|||||||
while AStream.Position < AStream.Size do begin
|
while AStream.Position < AStream.Size do begin
|
||||||
p := AStream.Position;
|
p := AStream.Position;
|
||||||
recType := WordLEToN(AStream.ReadWord);
|
recType := WordLEToN(AStream.ReadWord);
|
||||||
|
if recType = 0 then
|
||||||
|
break;
|
||||||
recSize := WordLEToN(AStream.ReadWord);
|
recSize := WordLEToN(AStream.ReadWord);
|
||||||
s := RecTypeName(recType);
|
s := RecTypeName(recType);
|
||||||
i := pos(':', s);
|
i := pos(':', s);
|
||||||
|
Reference in New Issue
Block a user