Page 1 of 1

LoadFromStream raise exception "can`t open file """

Posted: Wed Nov 10, 2010 6:56 am
by mustapha.wang
var
MS:TMemoryStream;
begin
MS:=TMemoryStream.Create;
try
MS.LoadFromFile('D:\A.xls');
MS.Position:=0;
XLSReadWriteII41.LoadFromStream(MS);
fianlly
MS.Free;
end;

Why need open file??

Re: LoadFromStream raise exception "can`t open file """

Posted: Wed Nov 10, 2010 7:09 am
by mustapha.wang
you always fix bug too late.

Maybe:

xlsReadII4.pas

move this code to the top of this procedure:

procedure TXLSReadII.LoadFromStream(Stream: TStream);
.....
{$IFDEF USE_MSSTORAGE} //move to top
FXLSStream.ExtraObjects := FXLS.ExtraObjects; //move to top
FXLSStream.SourceStream := Stream; //move to top
{$ENDIF} //move to top