Function TWPTextObj.EnumEmbeddedText(Mode:TWPTextObjEnumEmbeddedText; Callback:TWPTextObjEnumEmbeddedTextCallback; Data:TObject) : Boolean
Unit: WPRTEDefs
Class: WPRTEDefs.TWPTextObj
Parameters
-
Mode:TWPTextObjEnumEmbeddedText Callback:TWPTextObjEnumEmbeddedTextCallback Data:TObject
Returns
The type of the result value is Boolean.
Description
This method works with paired objects, such as hyperlinks or bookmarks. It returns false if the closing object could not be found. It calls the provided anonymous function for each embedded character, object or paragraph. This method can be used from Delphi XE. If you specify in mode wpenParStart, the callback will be called for each new paragraph and also the first, if the start object is at the beginning (white space and objects do not matter). If you specify wpenParBreak the callback will be called at the end of each paragraph and also for the last, if the closing object is the last non white space character in the paragraph. // Clear the character attributes in the current field
var obj : TWPTextObj;
begin
obj := WPRichText1.OpenCodeAtCP( wpobjMergeField );
if obj<>nil then
begin
obj.EnumEmbeddedText([wpenMarkParagraphsForInit],
procedure(C : Char; par : TParagraph;
posinpar : Integer; State : TWPTextObjEnumEmbeddedText;
Data : TObject; var Abort : Boolean)
begin
par.CharAttr[posinpar] := 0;
end
);
WPRichText1.ReformatAll(false,true);
end;
end;