Dynamically change font Style/Size in one row in TfrxRichView
Please for help with this problem. I need change font Style/Size in one row in TfrxRichView. In design mode it is possible. See attachment.
But I can't do it dynamically. I try this
I put frxReport1: TfrxReport on my Form and put TfrxRichView on Page1.
when I click Button1 printer print only second text ' This is size 14'. What is wrong?
Thank you.
procedure TForm1.Button1Click(Sender: TObject);
var R:TfrxRichView;
begin
r:= TfrxRichView(frxReport1.FindObject('Rich1'));
if r<>nil then begin
TfrxRichView®.RichEdit.SelAttributes.Size:=10;
TfrxRichView?®.RichEdit.SelAttributes.Style := [fsBold];
TfrxRichView?®.RichEdit.SelText := 'This is size 10';
TfrxRichView?®.RichEdit.SelAttributes.Size:=14;
TfrxRichView?®.RichEdit.SelAttributes.Style := [fsItalic];
TfrxRichView?®.RichEdit.SelText := ' This is size 14';
frxReport1.PrepareReport(true);
frxReport1.Print;
end;
end;
But I can't do it dynamically. I try this
I put frxReport1: TfrxReport on my Form and put TfrxRichView on Page1.
when I click Button1 printer print only second text ' This is size 14'. What is wrong?
Thank you.
procedure TForm1.Button1Click(Sender: TObject);
var R:TfrxRichView;
begin
r:= TfrxRichView(frxReport1.FindObject('Rich1'));
if r<>nil then begin
TfrxRichView®.RichEdit.SelAttributes.Size:=10;
TfrxRichView?®.RichEdit.SelAttributes.Style := [fsBold];
TfrxRichView?®.RichEdit.SelText := 'This is size 10';
TfrxRichView?®.RichEdit.SelAttributes.Size:=14;
TfrxRichView?®.RichEdit.SelAttributes.Style := [fsItalic];
TfrxRichView?®.RichEdit.SelText := ' This is size 14';
frxReport1.PrepareReport(true);
frxReport1.Print;
end;
end;
Comments
When TfrxRichView Text is 'abcdefghijklabcdefghijkl',