fpspreadsheet: Add TsWorksheetDataset.Flush to write a spreadsheet file to disk.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8100 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-09-28 22:15:10 +00:00
parent db6dc4b039
commit 83268bfd02

View File

@ -203,6 +203,7 @@ type
const AWorkbookFileName, ASheetName: String); const AWorkbookFileName, ASheetName: String);
function CreateBlobStream(Field: TField; Mode: TBlobStreamMode): TStream; override; function CreateBlobStream(Field: TField; Mode: TBlobStreamMode): TStream; override;
procedure CreateTable; procedure CreateTable;
procedure Flush;
function GetFieldData(Field: TField; Buffer: Pointer): Boolean; override; function GetFieldData(Field: TField; Buffer: Pointer): Boolean; override;
function Locate(const KeyFields: String; const KeyValues: Variant; function Locate(const KeyFields: String; const KeyValues: Variant;
Options: TLocateOptions): boolean; override; Options: TLocateOptions): boolean; override;
@ -1063,18 +1064,15 @@ begin
end; end;
end; end;
(* procedure TsWorksheetDataset.Flush;
// Removes characters from AText which would make it an invalid fieldname. const
function TsWorksheetDataset.FixFieldName(const AText: String): String; OVERWRITE = true;
var
ch: char;
begin begin
Result := ''; if FAutoFileFormat then
for ch in AText do FWorkbook.WriteToFile(FFileName, OVERWRITE)
if (ch in ['A'..'Z', 'a'..'z', '0'..'9']) then else
Result := Result + ch; FWorkbook.WriteToFile(FFileName, FFileFormat, OVERWRITE);
end; end;
*)
procedure TsWorksheetDataset.FreeBlobPointers(Buffer: TRecordBuffer); procedure TsWorksheetDataset.FreeBlobPointers(Buffer: TRecordBuffer);
var var
@ -1389,10 +1387,7 @@ begin
FIsOpen := false; FIsOpen := false;
if FModified then begin if FModified then begin
if FAutoFileFormat then Flush;
FWorkbook.WriteToFile(FFileName, true)
else
FWorkbook.WriteToFile(FFileName, FFileFormat, true);
FModified := false; FModified := false;
end; end;
FreeWorkbook; FreeWorkbook;