WordEnum Method |
[Top] [Chapter] [Previous] [Next] |
Applies to Declaration function WordEnum(const AWord: WideString; CaseSensitive: WordBool; OnlyActiveText: WordBool; ParamForEvent: LongWord): Integer; Description Triggers the event OnEnumParOrStyle for all occurances of the given word. (A "word" is text which is enclosed in space or punctation characters!)
C# Example to make all occurances of "td" (not case sensitive) bold and replace it with "TextDynamic".
private void testbutton_Click( object sender, System.EventArgs e) { WPDLLInt1.TextCursor.WordEnum( "td",false,true,0); WPDLLInt1.Memo.ReformatAll(true,true); }
private void WPDLLInt1_OnEnumParOrStyle( object Sender, bool IsControlPar, int StartPos, int Count, WPDynamic.IWPParInterface ParText, WPDynamic.IWPAttrInterface ParAttr, int EventParam, ref bool Abort) { string replacestr = "TextDynamic"; for(int i=0;i<Count;i++) { // Update the style (add bold) ParText.CharAttr(StartPos+i).IncludeStyles(1); } // Replace text (replacestr may have different length) ParText.ReplaceText(StartPos,Count,replacestr); }
|