Procedure TWPTextFinder.SelectText
Unit: WPRTEDefs
Class: WPRTEDefs.TWPTextFinder
Description
Selects the text which has been found. It also moves the cursor to the start of the selection.This example code replaces trhe text "sig" with a given image.
WPRichText1.Finder.ToStart;
while WPRichText1.Finder.Next('[sig]') do
begin
WPRichText1.Finder.SelectText;
WPRichText1.TextObjects.InsertCopy(Image1.Picture.Graphic);
end;
WPRichText1.DelayedReformat;
Unless you use WPRichText1.Finder.DontIgnoreObjects:=true; objects such as hyperlink start or end objects will be ignored when locating the text.