fpspreadsheet: Adds a work around for a internal compiler error, see bug 22370

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2475 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2012-07-05 13:34:55 +00:00
parent ee0b3b153c
commit 04181a810d

View File

@ -53,6 +53,7 @@ var
fsOLE: TVirtualLayer_OLE;
OLEStream: TStream;
VLAbsolutePath: UTF8String;
tmpStream: TStream; // workaround to a compiler bug, see bug 22370
begin
VLAbsolutePath:='/'+AStreamName; //Virtual layer always use absolute paths.
if not AOverwriteExisting and FileExists(AFileName) then begin
@ -62,7 +63,12 @@ begin
fsOLE:=TVirtualLayer_OLE.Create(RealFile);
fsOLE.Format(); //Initialize and format the OLE container.
OLEStream:=fsOLE.CreateStream(VLAbsolutePath,fmCreate);
AOLEDocument.Stream.Position:=0; //Ensures it is in the begining.
// work around code for the bug 22370
tmpStream:=AOLEDocument.Stream;
tmpStream.Position:=0; //Ensures it is in the begining.
//previous code: AOLEDocument.Stream.Position:=0; //Ensures it is in the begining.
OLEStream.CopyFrom(AOLEDocument.Stream,AOLEDocument.Stream.Size);
OLEStream.Free;
fsOLE.Free;