TECH TIP: Copy RTF Data from TRichEd to TppRichText
You can copy RTF data from Delphi’s TRichEd to ReportBuilder’s TppRichText control by using an intermediate memory stream:
var
lRTFStream: TMemoryStream;
begin
{create temp memory stream}
lRTFStream := TMemoryStream.Create;
{save the TRichEd's rtf data to the memory stream}
RichEdit1.Lines.SaveToStream(lRTFStream);
{load the rtf stream to the TppRichText}
lRTFStream.position := 0;
ppRichText1.LoadFromRTFStream(lRTFStream);
{free the memory stream}
lRTFStream.Free;
end;
Note: An alternative method would be to use RichEdit1.Lines.SaveToFile and TppRichText.LoadFromFile.