fpspreadsheet: Show details for MULBLANK records in BIFF explorer. Fix UTF8 filename issues.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3033 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-05-09 22:24:57 +00:00
parent e1ddf966a7
commit 407b2f1288
2 changed files with 38 additions and 5 deletions

View File

@ -61,6 +61,7 @@ type
procedure ShowLabelSSTCell;
procedure ShowLeftMargin;
procedure ShowMMS;
procedure ShowMulBlank;
procedure ShowNote;
procedure ShowNumberCell;
procedure ShowObj;
@ -333,6 +334,8 @@ begin
ShowMMS;
$009C:
ShowFnGroupCount;
$00BE:
ShowMulBlank;
$00DA:
ShowBookBool;
$00E0:
@ -2115,6 +2118,36 @@ begin
end;
procedure TBIFFGrid.ShowMulBlank;
var
w: Word;
numbytes: Integer;
i, nc: Integer;
begin
nc := (Length(FBuffer) - 6) div 2;
RowCount := FixedRows + 3 + nc;
numBytes := 2;
Move(FBuffer[FBufferIndex], w, numbytes);
ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)),
'Index to row');
Move(FBuffer[FBufferIndex], w, numbytes);
ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)),
'Index to first column');
for i:=0 to nc-1 do begin
Move(FBuffer[FBufferIndex], w, numbytes);
ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)),
Format('Index to XF record #%d', [i]));
end;
Move(FBuffer[FBufferIndex], w, numbytes);
ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)),
'Index to last column');
end;
procedure TBIFFGrid.ShowNote;
var
numBytes: Integer;

View File

@ -723,12 +723,12 @@ var
valid: Boolean;
excptn: Exception = nil;
begin
if not FileExists(AFileName) then begin
if not FileExistsUTF8(AFileName) then begin
MessageDlg(Format('File "%s" not found.', [AFileName]), mtError, [mbOK], 0);
exit;
end;
if not SameText(ExtractFileExt(AFileName), '.xls') then begin
if Lowercase(ExtractFileExt(AFileName)) <> '.xls' then begin
MessageDlg('BIFFExplorer can only process binary Excel files (extension ".xls")',
mtError, [mbOK], 0);
exit;
@ -771,14 +771,14 @@ begin
MemStream := TMemoryStream.Create;
if AFormat = sfExcel2 then begin
MemStream.LoadFromFile(AFileName);
MemStream.LoadFromFile(UTF8ToSys(AFileName));
end else begin
OLEStorage := TOLEStorage.Create;
// Only one stream is necessary for any number of worksheets
OLEDocument.Stream := MemStream;
if AFormat = sfExcel8 then streamname := 'Workbook' else streamname := 'Book';
OLEStorage.ReadOLEFile(AFileName, OLEDocument, streamname);
OLEStorage.ReadOLEFile(UTF8ToSys(AFileName), OLEDocument, streamname);
// Check if the operation succeded
if MemStream.Size = 0 then
@ -787,7 +787,7 @@ begin
// Rewind the stream and read from it
MemStream.Position := 0;
FFileName := ExpandFileName(AFileName);
FFileName := ExpandFileName(UTF8ToSys(AFileName));
ReadFromStream(MemStream);
FFormat := AFormat;