You've already forked lazarus-ccr
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:
@ -60,7 +60,10 @@ begin
|
|||||||
if FWorkbook <> nil then
|
if FWorkbook <> nil then
|
||||||
OpenDialog.InitialDir := ExtractFileDir(FWorkbook.FileName);
|
OpenDialog.InitialDir := ExtractFileDir(FWorkbook.FileName);
|
||||||
if OpenDialog.Execute then begin
|
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);
|
LoadFile(OpenDialog.FileName, fmt);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -97,6 +100,12 @@ procedure TMainForm.FormCreate(Sender: TObject);
|
|||||||
var
|
var
|
||||||
priorityFormats: Array[0..7] of TsSpreadFormatID;
|
priorityFormats: Array[0..7] of TsSpreadFormatID;
|
||||||
begin
|
begin
|
||||||
|
{
|
||||||
|
Grid.RowCount:=2;
|
||||||
|
Grid.ColCount:=2;
|
||||||
|
Grid.AutoExpand:= [];
|
||||||
|
}
|
||||||
|
|
||||||
priorityFormats[0] := ord(sfOOXML);
|
priorityFormats[0] := ord(sfOOXML);
|
||||||
priorityFormats[1] := ord(sfExcel8);
|
priorityFormats[1] := ord(sfExcel8);
|
||||||
priorityFormats[2] := ord(sfExcel5);
|
priorityFormats[2] := ord(sfExcel5);
|
||||||
|
@ -7392,6 +7392,11 @@ begin
|
|||||||
if not FileExists(AFileName) then
|
if not FileExists(AFileName) then
|
||||||
raise Exception.CreateFmt(rsFileNotFound, [AFileName]);
|
raise Exception.CreateFmt(rsFileNotFound, [AFileName]);
|
||||||
|
|
||||||
|
if AFormatID = sfIDUnknown then begin
|
||||||
|
ReadFromFile(AFileName, AParams);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
AReader := CreateSpreadReader(self, AFormatID);
|
AReader := CreateSpreadReader(self, AFormatID);
|
||||||
try
|
try
|
||||||
FFileName := AFileName;
|
FFileName := AFileName;
|
||||||
|
Reference in New Issue
Block a user