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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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.