* fpspreadsheet: db export: export from beginning of dataset. Some hardening.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3627 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
bigchimp
2014-10-03 16:22:20 +00:00
parent 6f14b93502
commit 91e22cd724

View File

@ -86,6 +86,7 @@ const
resourcestring
SFPSDescription = 'Spreadsheet files';
SFPSFileMustExist = 'Empty file names are not allowed.';
implementation
@ -116,11 +117,16 @@ end;
procedure TCustomFPSExport.DoBeforeExecute;
begin
Inherited;
if FFileName='' then
Raise EDataExporter.Create(SFPSFileMustExist);
FSpreadsheet:=TsWorkbook.Create;
// For extra performance. Note that virtual mode is not an option
// due to the data export determining flow of the program.
FSpreadsheet.Options:=FSpreadsheet.Options+[boBufStream];
FSheet:=FSpreadsheet.AddWorksheet('1');
// todo: look into restoring position after done
if not(Dataset.IsUniDirectional) then
Dataset.First; // needed to export all items
FRow:=0;
end;