fpspreadsheet: Implement SaveToStream for ODS writer (code from SaveToFile)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3368 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
fce1ea9409
commit
ee1fafb7ef
@ -3147,11 +3147,29 @@ end;
|
|||||||
}
|
}
|
||||||
procedure TsSpreadOpenDocWriter.WriteToFile(const AFileName: string;
|
procedure TsSpreadOpenDocWriter.WriteToFile(const AFileName: string;
|
||||||
const AOverwriteExisting: Boolean);
|
const AOverwriteExisting: Boolean);
|
||||||
|
var
|
||||||
|
lStream: TStream;
|
||||||
|
lMode: word;
|
||||||
|
begin
|
||||||
|
if AOverwriteExisting
|
||||||
|
then lMode := fmCreate or fmOpenWrite
|
||||||
|
else lMode := fmCreate;
|
||||||
|
|
||||||
|
if (boBufStream in Workbook.Options) then
|
||||||
|
lStream := TBufStream.Create(AFileName, lMode)
|
||||||
|
else
|
||||||
|
lStream := TFileStream.Create(AFileName, lMode);
|
||||||
|
try
|
||||||
|
WriteToStream(lStream);
|
||||||
|
finally
|
||||||
|
FreeAndNil(lStream);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsSpreadOpenDocWriter.WriteToStream(AStream: TStream);
|
||||||
var
|
var
|
||||||
FZip: TZipper;
|
FZip: TZipper;
|
||||||
begin
|
begin
|
||||||
Unused(AOverwriteExisting);
|
|
||||||
|
|
||||||
{ Analyze the workbook and collect all information needed }
|
{ Analyze the workbook and collect all information needed }
|
||||||
ListAllNumFormats;
|
ListAllNumFormats;
|
||||||
ListAllFormattingStyles;
|
ListAllFormattingStyles;
|
||||||
@ -3172,7 +3190,7 @@ begin
|
|||||||
{ Now compress the files }
|
{ Now compress the files }
|
||||||
FZip := TZipper.Create;
|
FZip := TZipper.Create;
|
||||||
try
|
try
|
||||||
FZip.FileName := AFileName;
|
FZip.FileName := '__temp__.tmp';
|
||||||
|
|
||||||
FZip.Entries.AddFileEntry(FSMeta, OPENDOC_PATH_META);
|
FZip.Entries.AddFileEntry(FSMeta, OPENDOC_PATH_META);
|
||||||
FZip.Entries.AddFileEntry(FSSettings, OPENDOC_PATH_SETTINGS);
|
FZip.Entries.AddFileEntry(FSSettings, OPENDOC_PATH_SETTINGS);
|
||||||
@ -3183,20 +3201,22 @@ begin
|
|||||||
|
|
||||||
ResetStreams;
|
ResetStreams;
|
||||||
|
|
||||||
FZip.ZipAllFiles;
|
FZip.SaveToStream(AStream);
|
||||||
|
|
||||||
finally
|
finally
|
||||||
DestroyStreams;
|
DestroyStreams;
|
||||||
FZip.Free;
|
FZip.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
(*
|
||||||
procedure TsSpreadOpenDocWriter.WriteToStream(AStream: TStream);
|
procedure TsSpreadOpenDocWriter.WriteToStream(AStream: TStream);
|
||||||
begin
|
begin
|
||||||
Unused(AStream);
|
Unused(AStream);
|
||||||
// Not supported at the moment
|
// Not supported at the moment
|
||||||
raise Exception.Create('TsSpreadOpenDocWriter.WriteToStream not supported');
|
raise Exception.Create('TsSpreadOpenDocWriter.WriteToStream not supported');
|
||||||
end;
|
end;
|
||||||
|
*)
|
||||||
|
|
||||||
procedure TsSpreadOpenDocWriter.WriteFormula(AStream: TStream; const ARow,
|
procedure TsSpreadOpenDocWriter.WriteFormula(AStream: TStream; const ARow,
|
||||||
ACol: Cardinal; const AFormula: TsFormula; ACell: PCell);
|
ACol: Cardinal; const AFormula: TsFormula; ACell: PCell);
|
||||||
|
Loading…
Reference in New Issue
Block a user