Page 1 of 1

SaveToStream Bug

Posted: Mon Feb 24, 2014 3:38 pm
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

Re: SaveToStream Bug

Posted: Tue Feb 25, 2014 12:33 pm
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.

Re: SaveToStream Bug

Posted: Tue Feb 25, 2014 12:57 pm
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;