Board index » delphi » How to get the RTF from a RichEdit?

How to get the RTF from a RichEdit?

How do I get the RTF from a RichEdit component. Accessing the Lines gives me
just the text, not the actual RTF.

- daniel

--
If the only tool you have is a hammer, all problems look like nails.

 

Re:How to get the RTF from a RichEdit?


In article <3b551c2...@news.attica.net.nz>, "Daniel Rutten" <n...@junk.com>
writes:

Quote
>How do I get the RTF from a RichEdit component. Accessing the Lines gives me
>just the text, not the actual RTF.

You have to stream it out - to a TMemoryStream, TFileStream TStringStream etc.

var
  MS : TMemoryStream;
begin
  RichEdit1.Lines.LoadFromFile('E:\Colour.rtf');
  MS := TMemoryStream.Create;
  RichEdit1.Lines.SaveToStream(MS);
  MS.Seek(0, soFromBeginning);
  Memo1.Lines.LoadFromStream(MS);  // Memo1 displays raw rtf
  MS.Free;
end;

Quote
>If the only tool you have is a hammer, all problems look like nails.

... but often when that is the case one also finds that the user thinks that
the points are at the wrong end.

Alan Lloyd
alangll...@aol.com

Other Threads