You've already forked lazarus-ccr
fpspreadsheet: Fix failure of reading BIFF5 files in BIFFExplorer.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2972 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -223,7 +223,7 @@
|
|||||||
</Other>
|
</Other>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions Count="3">
|
<Exceptions Count="4">
|
||||||
<Item1>
|
<Item1>
|
||||||
<Name Value="EAbort"/>
|
<Name Value="EAbort"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
@ -233,6 +233,9 @@
|
|||||||
<Item3>
|
<Item3>
|
||||||
<Name Value="EFOpenError"/>
|
<Name Value="EFOpenError"/>
|
||||||
</Item3>
|
</Item3>
|
||||||
|
<Item4>
|
||||||
|
<Name Value="EStreamError"/>
|
||||||
|
</Item4>
|
||||||
</Exceptions>
|
</Exceptions>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
</CONFIG>
|
</CONFIG>
|
||||||
|
@ -366,7 +366,6 @@ object MainForm: TMainForm
|
|||||||
object BtnFindNext: TSpeedButton
|
object BtnFindNext: TSpeedButton
|
||||||
Left = 240
|
Left = 240
|
||||||
Height = 22
|
Height = 22
|
||||||
Hint = 'Find next'
|
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 23
|
Width = 23
|
||||||
Action = AcFindNext
|
Action = AcFindNext
|
||||||
@ -411,7 +410,6 @@ object MainForm: TMainForm
|
|||||||
object BtnFindPrev: TSpeedButton
|
object BtnFindPrev: TSpeedButton
|
||||||
Left = 216
|
Left = 216
|
||||||
Height = 22
|
Height = 22
|
||||||
Hint = 'Find previous'
|
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 23
|
Width = 23
|
||||||
Action = AcFindPrev
|
Action = AcFindPrev
|
||||||
@ -453,10 +451,9 @@ object MainForm: TMainForm
|
|||||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
object BtnCloseFind: TSpeedButton
|
object SpeedButton3: TSpeedButton
|
||||||
Left = 3
|
Left = 3
|
||||||
Height = 22
|
Height = 22
|
||||||
Hint = 'Close "Find" panel'
|
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 23
|
Width = 23
|
||||||
Action = AcFindClose
|
Action = AcFindClose
|
||||||
|
@ -757,6 +757,7 @@ end;
|
|||||||
procedure TMainForm.LoadFile(const AFileName: String; AFormat: TsSpreadsheetFormat);
|
procedure TMainForm.LoadFile(const AFileName: String; AFormat: TsSpreadsheetFormat);
|
||||||
var
|
var
|
||||||
OLEDocument: TOLEDocument;
|
OLEDocument: TOLEDocument;
|
||||||
|
streamname: UTF8String;
|
||||||
begin
|
begin
|
||||||
if MemStream <> nil then
|
if MemStream <> nil then
|
||||||
FreeAndNil(MemStream);
|
FreeAndNil(MemStream);
|
||||||
@ -773,7 +774,8 @@ begin
|
|||||||
|
|
||||||
// Only one stream is necessary for any number of worksheets
|
// Only one stream is necessary for any number of worksheets
|
||||||
OLEDocument.Stream := MemStream;
|
OLEDocument.Stream := MemStream;
|
||||||
OLEStorage.ReadOLEFile(AFileName, OLEDocument, 'Workbook');
|
if AFormat = sfExcel8 then streamname := 'Workbook' else streamname := 'Book';
|
||||||
|
OLEStorage.ReadOLEFile(AFileName, OLEDocument, streamname);
|
||||||
|
|
||||||
// Check if the operation succeded
|
// Check if the operation succeded
|
||||||
if MemStream.Size = 0 then
|
if MemStream.Size = 0 then
|
||||||
@ -1115,7 +1117,13 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.UpdateCaption;
|
procedure TMainForm.UpdateCaption;
|
||||||
begin
|
begin
|
||||||
Caption := Format('BIFF Explorer - "%s', [IfThen(FFileName <> '', FFileName, 'no file loaded')]);
|
if FFileName = '' then
|
||||||
|
Caption := 'BIFF Explorer - (no file loaded)'
|
||||||
|
else
|
||||||
|
Caption := Format('BIFF Explorer - "%s [%s]', [
|
||||||
|
FFileName,
|
||||||
|
GetFileFormatName(FFormat)
|
||||||
|
]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,12 +5,14 @@ unit beUtils;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, IniFiles, Forms;
|
Classes, SysUtils, IniFiles, Forms,
|
||||||
|
fpspreadsheet;
|
||||||
|
|
||||||
function CreateIni : TCustomIniFile;
|
function CreateIni : TCustomIniFile;
|
||||||
procedure ReadFormFromIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm);
|
procedure ReadFormFromIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm);
|
||||||
procedure WriteFormToIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm);
|
procedure WriteFormToIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm);
|
||||||
|
|
||||||
|
function GetFileFormatName(AFormat: TsSpreadsheetFormat): String;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -62,5 +64,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetFileFormatName(AFormat: TsSpreadsheetFormat): string;
|
||||||
|
begin
|
||||||
|
case AFormat of
|
||||||
|
sfExcel2 : Result := 'BIFF2';
|
||||||
|
sfExcel3 : Result := 'BIFF3';
|
||||||
|
sfExcel4 : Result := 'BIFF4';
|
||||||
|
sfExcel5 : Result := 'BIFF5';
|
||||||
|
sfExcel8 : Result := 'BIFF8';
|
||||||
|
sfooxml : Result := 'OOXML';
|
||||||
|
sfOpenDocument : Result := 'Open Document';
|
||||||
|
sfCSV : Result := 'CSV';
|
||||||
|
sfWikiTable_Pipes : Result := 'WikiTable Pipes';
|
||||||
|
sfWikiTable_WikiMedia : Result := 'WikiTable WikiMedia';
|
||||||
|
else Result := '-unknown format-';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user