You can use a TppRichText component and load the RichText data into the component's RichText property from the memory stream either in the OnPrint event of the component or any other event that is guaranteed to fire before the component is laid onto the page (ie. Detail Band's BeforePrint). You can use the LoadFromMemoryStream method of the component, ie.
Each RichText component has it's own RichText string reference. Therefore if you need multiple RichText components throughout the detailband, because of the way dDlphi handles string references, the best solution would be to copy the string into a globally accessible variable and have each of the components reference it. This would increase performance and save memory. You would want to do this in the in the BeforePrint event of the detail band. For example.
procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject); var lStream: TMemoryStream; begin lStream := TMemoryStream.Create;
... load rich text data into stream
lStream.Position := 0; SetLength(FRichText, lStream.Size); // FRichText is a global richtext string lStream.Read(PChar(FRichText)^, lStream.Size);
Comments
component's RichText property from the memory stream either in the OnPrint
event of the component or any other event that is guaranteed to fire before
the component is laid onto the page (ie. Detail Band's BeforePrint). You can
use the LoadFromMemoryStream method of the component, ie.
lRTFStream.position := 0;
ppRichText1.LoadFromRTFStream(lRTFStream);
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
where should i put the code then
grtzz Frank
you need multiple RichText components throughout the detailband, because of
the way dDlphi handles string references, the best solution would be to copy
the string into a globally accessible variable and have each of the
components reference it. This would increase performance and save memory.
You would want to do this in the in the BeforePrint event of the detail
band. For example.
procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
var
lStream: TMemoryStream;
begin
lStream := TMemoryStream.Create;
... load rich text data into stream
lStream.Position := 0;
SetLength(FRichText, lStream.Size); // FRichText is a global richtext
string
lStream.Read(PChar(FRichText)^, lStream.Size);
ppRichText1.RichText := FRichText;
...
ppRichTextX.RichText := FRichText;
end;
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com