WPCubed Product Support

Replace coloured text

Hi!

I'm trying to replace all red-coloured-text in my document and using this code:

ReHelpText.Finder.Clear;
ReHelpText.Finder.ToStart;
ReHelpText.Finder.CharAttr.SetColor(clRed);
ReHelpText.Finder.WholeWord:=true;
ReHelpText.Finder.WildCard:='*';
while ReHelpText.Finder.Next('*') do
begin
ReHelpText.Finder.FoundText:='Test';
ReHelpText.Finder.FoundAttr.SetColor(clBlack);
end;

It doesn't work. The finder always goes to the end of the text an inserts the word 'Test'. What am I doing wrong?

#1 ♥ 0
3.5k Views 2 users read 1 min
support

Hi,

when you use the brand new V5.10 the above code will work with a minor change:
ReHelpText.Finder.EndAtWord := TRUE
instead of
ReHelpText.Finder.WholeWord:=true;

There is a new demo included 'finder' which uses this code.

Julian

#2 ♥ 0
This category is archived. No new posts are possible.