Procedure TWPCustomRtfEdit.EnumText(Callback:TWPEnumTextCallback; Mode:TWPEnumTextModes; AllTexts:Boolean)

Unit: WPCTRMemo
Class: WPCTRMemo.TWPCustomRtfEdit

Parameters

Description

This method can be used to call an anoymous method to check and possibly change the complete body text. The method is called for all individual characters and embedded text objects. If AllTexts = true, also header and footer are checked. // This code deletes duplicated spaces WPRichText1.EnumText( procedure( Par : TParagraph; // This is the current paragraph PosInPar : Integer; // This is the current position in the paragraph. -1 for empty paragraphs var DeleteElement : Boolean; // Set this to true to delete the character (you cannot delete paragraphs) var Abort : Boolean) // Set this to true to abort the loop ) begin if Par.CharAtIs(PosInPar,#32) and Par.CharAtIs(PosInPar+1,#32) then DeleteElement := true; end, [], false ); WPRichText1.ReformatAll();