SaveToStream Bug

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
damien
Posts: 2
Joined: Mon Feb 24, 2014 1:39 pm

SaveToStream Bug

Post by damien »

hi
I'm using a empty workbook in excel97
when i'm save the file with SaveToStream the file is not valid for excel but i't ok with SaveToFile

To test:

Code: Select all

procedure TForm1.Button2Click(Sender: TObject);
var
  S : TXLSWorksheet;
    data : TMemorystream;
begin
  XLSReadWriteII51.LoadFromFile(ExtractfilePath(ParamStr(0))+ 'empty.xls');;

  s := XLSReadWriteII51.Add();
  S.Name := 'tata';
  S.AsString[1,0] := 'something';

  data := TMemoryStream.Create;

  XLSReadWriteII51.SaveToStream(data);
  data.SaveToFile(ExtractfilePath(ParamStr(0))+ 'test2.xls');

  XLSReadWriteII51.SaveToFile(extractfilePath(ParamStr(0))+ 'test3.xls');
end;
test2.xls isn't valid , and test3.xls is valid
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: SaveToStream Bug

Post by larsa »

Hello

I could not reproduce this. Please make sure that you uses the latest update. If the problem persists, please send me the excel file.
Lars Arvidsson, Axolot Data
damien
Posts: 2
Joined: Mon Feb 24, 2014 1:39 pm

Re: SaveToStream Bug

Post by damien »

Hi

i downloaded the last version 5.20.18 but it's the same thing

The excel file is just a new empty workbook is Excel97 format
here another way

Code: Select all

var
  S : TXLSWorksheet;
    data : TMemorystream;
    xls: TXLSReadWriteII5;
begin
  xls := TXLSReadWriteII5.Create(nil);
  xls.Version := xvExcel97;

  s := xls.Add();
  S.Name := 'tata';
  S.AsString[1,0] := 'something';

  data := TMemoryStream.Create;

  xls.SaveToStream(data);
  data.SaveToFile(ExtractfilePath(ParamStr(0))+ 'test2.xls');

  xls.SaveToFile(extractfilePath(ParamStr(0))+ 'test3.xls');

  data.Free;
  xls.Free
end;
Post Reply