RichText not displaying in TRichView or QR components
I actually found a solution, by testing just the RTF control in Win98 vs
Win2000 or XP. I found that the RTF was not displaying properly in just a
TRichView component (not just in the QuickReport component). After I found a
way to get around this problem, the quick report required a small tweak and
now it works properly!
(1) Solve the problem of the RTF not showing properly in TRichView:
By using a TStringStream and TRichView.Lines.LoadFromStream the control will
load the RTF properly and display it correctly in the TRichView component
(in both Win98 and up).
procedure LoadRTF(ALines:TStrings;const aRTF:string);
var
strStream : TStringStream;
begin
strStream := TStringStream.Create(aRTF);
try
strStream.Seek(0,soFromBeginning);
ALines.LoadFromStream(strStream);
finally
FreeAndNil(strStream);
end; {try}
end; {--LoadRTF--}
(2) Solve the problem of the RTF not showing in the QuickReport component
Even with the Fix in (1) applied, the QuickReport component still did not
work (I was using the ParentRichText property to get the rtf for the
component). However, by following the advice on your website, I removed the
reference to the parent rich text control, and instead placed the loading of
the rtf directly into the QuickReport component in the BeforePrint method
procedure TFormReportDetailed_Intro.QuickRepIntroBeforePrint(
Sender: TCustomQuickRep; var PrintReport: Boolean);
begin
LoadRTF(rtfIntro.Lines,IDS_ReportDetailed_RTF_Intro);
end;
-------------------------------------------------------------------------
This work was done by Narath Carlile who has all our thanks.