Function TWPCustomRtfEdit.CodeLocate(ResultPar:TParagraph; ResultPosInPar:Integer; AName:string; Code:TWPTextObjType; CmpModes:TWPTextObjModes; LocateOptions:TWPCodeLocateOptions; CmpStr2:string) : Boolean

Unit: WPCTRMemo
Class: WPCTRMemo.TWPCustomRtfEdit

Parameters

Returns

The type of the result value is Boolean.

Description

Works like but sets the result variables ResultPar and ResultPosInPar.

This example code will locate any bookmark and change the character style to "bold": var ResultPar: TParagraph; ResultPosInPar: Integer; begin WPRichText1.CPPosition := 0; WPRichText1.TextCursor.SelectText := false; while WPRichText1.CodeLocate( ResultPar, ResultPosInPar, '', wpobjBookmark, [wpobjIsOpening], [wpStartAtCursorPosition]) do begin WPRichText1.TextCursor.SelectText := false; WPRichText1.TextCursor.MoveTo(ResultPar, ResultPosInPar); if WPRichText1.CPObj<>nil then begin WPRichText1.TextCursor.SelectToHere(WPRichText1.CPObj.EndTag); WPRichText1.CurrAttr.AddStyle([afsBold]); end; WPRichText1.CPMoveNext; // Skip Object! end; WPRichText1.ReformatAll(true,true); end;