replace for only arial font text

General TRichView support forum. Please post your questions here
Post Reply
sr1111
Posts: 27
Joined: Thu Jan 31, 2008 12:18 pm

replace for only arial font text

Post by sr1111 »

I want to text replace only arial font
how can I make


my code (all text arial, bad)
with Srv.RichViewEdit do
for i :=0 to Srv.RichViewEdit.style.TextStyles.Count-1 do
Srv.RichViewEdit.Style.TextStyles.FontName := 'Arial';
Srv.RichViewEdit.Format;
begin
APPLICATION.ProcessMessages;
stringReplace('orange', 'aplle');
Sergey Tkachenko
Site Admin
Posts: 17571
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, I do not understand the question.
Do you want to replace 'orange' to 'apple' only if 'orange' is written with 'Arial' font?
sr1111
Posts: 27
Joined: Thu Jan 31, 2008 12:18 pm

Post by sr1111 »

yes, I want to replace 'orange' to 'apple' only if 'orange' is written with 'Arial' font
Sergey Tkachenko
Site Admin
Posts: 17571
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If it should be an editing operation (undone):

Code: Select all

with RichViewEdit1 do begin
  SetSelectionBounds(0, GetOffsBeforeItem(0), 0, GetOffsBeforeItem(0));
  while SearchText('orange', [rvseoDown]) do
    if CompareText(Style.TextStyles[CurTextStyleNo].FontName, 'Arial')=0 then
      InsertText('apple');
end;
sr1111
Posts: 27
Joined: Thu Jan 31, 2008 12:18 pm

Post by sr1111 »

thanks very good.
please can you tell me, how can I make this(replace) normal in the delphi richedit
Post Reply