I need to save and load Chart, customized by a end-user, to a Memo field dataset. So I need save a text the best way for maintenance/update/fix. I need XMl or INI or a plain text format.
I have tried to use these methods :
SaveChartToXMLStream
Code: Select all
procedure TForm1.BSaveClick(Sender: TObject);
var
lStringStream:TStringStream;
begin
lStringStream:= TStringStream.Create;
try
SaveChartToXMLStream(chart1, lStringStream);
lStringStream.Position:=0;
MemoXML.Lines.LoadFromStream(lStringStream );
finally
lStringStream.Free;
end;
end;
LoadChartFromStream
Code: Select all
procedure TForm1.BLoadClick(Sender: TObject);
var
lStringStream:TStringStream;
begin
lStringStream:= TStringStream.Create;
try
MemoXML.Lines.savetoStream(lStringStream);
lStringStream.Position:=0;
LoadChartFromStream(chart1, ConvertXMLToText(lStringStream) );
finally
lStringStream.Free;
end;
end;
SaveChartToXMLStream seems to work.
But after I can't load it with LoadChartFromStream ?
Full sample in attachment :
1) Double click on Chart -> Modify it foir example add a seire with random values
2) Try save -> seems to be Ok
3) Try load -> Chart became empty, try a second time Chat become invisible etc...
Using TTeeXMLSource doesn't help because I don't understand how to use it without a file :
https://www.steema.com/docs/teechart/vc ... rial15.htm
I need a LoadChartFromXMLStream or LoadChartFromXMLTSTringsStream/SaveChartToXMLTStrings ?