Description
This example shows how to load the content of a text file (or a stream)
into a TOutline object and how to save the content of the outline into a
text file (or a stream).
Code
var
TempStream : TMemoryStream;
procedure TMainForm.btLoadClick(Sender: TObject);
begin
{ Load the content of the input file in the first outline }
Outline1.LoadFromFile('input.txt');
{ Save the content of the outline in the memory stream }
Outline1.SaveToStream(TempStream);
{ Move the pointer at the begining of the stream }
TempStream.Seek(0, soFromBeginning);
end;
procedure TMainForm.btSaveClick(Sender: TObject);
begin
{ Load the content of the stream in the second outline }
Outline2.LoadFromStream(TempStream);
{ Save the content of the outline in the output file }
Outline2.SaveToFile('output.txt');
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
{ Create a memory stream }
TempStream := TMemoryStream.Create();
end;
procedure TMainForm.FormDestroy(Sender: TObject);
begin
TempStream.Free;
end;
end.
Uses