Page 1 of 1

replace for only arial font text

Posted: Thu Apr 30, 2009 4:05 am
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');

Posted: Thu Apr 30, 2009 9:52 am
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?

Posted: Thu Apr 30, 2009 7:09 pm
by sr1111
yes, I want to replace 'orange' to 'apple' only if 'orange' is written with 'Arial' font

Posted: Fri May 01, 2009 6:13 pm
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;

Posted: Sat May 09, 2009 8:48 am
by sr1111
thanks very good.
please can you tell me, how can I make this(replace) normal in the delphi richedit