Hi,
Using TeeChart Pro 2011.03.30407 for Delphi 2007, I am saving and a chart to stream and then later reloading from that same stream. The LoadChartFromStream call fails with the message 'Wrong *.tee file format'.
If I write the saved chart stream's DataString to file, then a call to LoadChartFromFile works fine.
Any suggestions?
Thanks very much.
Toreba
Wrong *.tee file format in LoadChartFromStream
Re: Wrong *.tee file format in LoadChartFromStream
Hi Toreba,
Check the stream Position is 0 before loading it.
the following example seems to work fine for me here:
Check the stream Position is 0 before loading it.
the following example seems to work fine for me here:
Code: Select all
uses Series, TeeStore;
var stream: TMemoryStream;
procedure TForm1.FormCreate(Sender: TObject);
begin
with Chart1.AddSeries(TBarSeries) do
begin
FillSampleValues;
ColorEachPoint:=true;
end;
end;
procedure TForm1.SaveToStreamClick(Sender: TObject);
begin
stream:=TMemoryStream.Create;
SaveChartToStream(Chart1, stream);
end;
procedure TForm1.ClearChartClick(Sender: TObject);
begin
Chart1.ClearChart;
end;
procedure TForm1.LoadFromStreamClick(Sender: TObject);
var tmpChart: TCustomChart;
begin
if stream<>nil then
begin
stream.Position:=0;
Chart1.Free;
tmpChart:=TChart.Create(Self);
LoadChartFromStream(tmpChart, stream);
Chart1:=tmpChart as TChart;
Chart1.Parent:=Self;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Wrong *.tee file format in LoadChartFromStream
Yes, that works! Thanks very much Yeray.