fpspreadsheet: Fix zoom demo file reading error if format is unknown.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5240 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
1257b32614
commit
9eb50b81d3
@ -60,7 +60,10 @@ begin
|
||||
if FWorkbook <> nil then
|
||||
OpenDialog.InitialDir := ExtractFileDir(FWorkbook.FileName);
|
||||
if OpenDialog.Execute then begin
|
||||
fmt := FOpenFormats[OpenDialog.FilterIndex-1];
|
||||
if OpenDialog.FilterIndex < 3 then
|
||||
fmt := sfidUnknown
|
||||
else
|
||||
fmt := FOpenFormats[OpenDialog.FilterIndex - 3];
|
||||
LoadFile(OpenDialog.FileName, fmt);
|
||||
end;
|
||||
end;
|
||||
@ -97,6 +100,12 @@ procedure TMainForm.FormCreate(Sender: TObject);
|
||||
var
|
||||
priorityFormats: Array[0..7] of TsSpreadFormatID;
|
||||
begin
|
||||
{
|
||||
Grid.RowCount:=2;
|
||||
Grid.ColCount:=2;
|
||||
Grid.AutoExpand:= [];
|
||||
}
|
||||
|
||||
priorityFormats[0] := ord(sfOOXML);
|
||||
priorityFormats[1] := ord(sfExcel8);
|
||||
priorityFormats[2] := ord(sfExcel5);
|
||||
|
@ -7392,6 +7392,11 @@ begin
|
||||
if not FileExists(AFileName) then
|
||||
raise Exception.CreateFmt(rsFileNotFound, [AFileName]);
|
||||
|
||||
if AFormatID = sfIDUnknown then begin
|
||||
ReadFromFile(AFileName, AParams);
|
||||
exit;
|
||||
end;
|
||||
|
||||
AReader := CreateSpreadReader(self, AFormatID);
|
||||
try
|
||||
FFileName := AFileName;
|
||||
|
Loading…
Reference in New Issue
Block a user