1 (edited by Parmida48 2019-02-01 16:02:36)

Topic: How to use Find and Replace of RTF Control in Code

Hello everybody
How to  use find and replace command of RichText Control in Code?
Thanks for your time.

2 (edited by Parmida48 2019-02-02 05:14:25)

Re: How to use Find and Replace of RTF Control in Code

Dmitry ,Please help.
Thanks.

Re: How to use Find and Replace of RTF Control in Code

//procedure for replace string
procedure ReplaceStrRich(RichEdit: TdbRichEdit; FromText, ToText: string);
begin
    if Form1.RichEdit1.SearchText(FromText, False, False) then Form1.RichEdit1.InsertText(ToText, False)
    else if Form1.RichEdit1.SearchText(FromText, False, True) then Form1.RichEdit1.InsertText(ToText, False);
end;


// how to use
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
   ReplaceStrRich(Form1.RichEdit1, 'Hello', 'Bye');
end;
Dmitry.

4 (edited by Parmida48 2019-02-10 17:48:47)

Re: How to use Find and Replace of RTF Control in Code

Thanks so much.