I use Delphi XE2, Richview 13.6.2 and Report Builder 14.02.
I try to change font name with this code :
Code: Select all
var
oStr: TStringStream;
iFont: Integer;
begin
oStr := TStringStream.Create(Value);
oStr.Position := 0;
ppRichView.RichView.Clear;
ppRichView.RichView.LoadRTFFromStream(oStr);
for iFont := ppRichView.RichView.Style.TextStyles.Count - 1 downto 0 do
begin
if ( SameText(ppRichView.RichView.Style.TextStyles[iFont].FontName, 'MS Sans Serif') ) then
ppRichView.RichView.Style.TextStyles[iFont].FontName := 'Microsoft Sans Serif'
else if ( SameText(RichView.Style.TextStyles[iFont].FontName, 'Courier')) then
ppRichView.RichView.Style.TextStyles[iFont].FontName := 'Courier New';
end;
ppRichView.RichView.Format;
oStr.Free;
Other information:
ppRichView.RichView.Style.TextStyles.Count = 7
ppRichView.RichView.Style.TextStyles[0].FontName := 'MS Sans Serif'
ppRichView.RichView.Style.TextStyles[1].FontName := 'Arial'
ppRichView.RichView.Style.TextStyles[2].FontName := 'Arial'
ppRichView.RichView.Style.TextStyles[3].FontName := 'Arial'
ppRichView.RichView.Style.TextStyles[4].FontName := 'Arial'
ppRichView.RichView.Style.TextStyles[5].FontName := 'Arial'
ppRichView.RichView.Style.TextStyles[6].FontName := 'Arial'
In function "TRVStyle.GetAsDevicePixelsX"
Result := Round(Value / PSaD.ppixScreen * PSaD.ppixDevice)
Value = 0
PSaD.ppixScreen = 0
PSaD.ppixDevice = 1440
Best regards