Declaration
void EnumParagraphs([In] bool OnlyActiveText, [In] int EventParam);
Description
The event OnEnumParOrStyle will be called for all paragraphs in the Document.
You can use TextCursor.CheckState(10) to force the PropChanged event which is required to update a data bound control.
Parameters |
OnlyActiveText |
If true, only the paragraphs in the active text, this is the current text layer (such as the header or footer) or the text body, will be visited. |
EventParam |
This value will be passed through to the event handler. |
Example:
Make all "bold" text "italic". This uses the method IWPParInterface.ParCommand.
The event handler:
private void wpdllInt1_OnEnumParOrStyle(object Sender, bool IsControlPar, int StartPos, int Count, WPDynamic.IWPParInterface ParText, WPDynamic.IWPAttrInterface ParAttr, int EventParam, ref bool Abort)
{
IWPParInterface Par = ParText;
int a = 1;
int p = 0;
while(a>0)
{
a = Par.ParCommand(7, (7 << 24) + 0, p);
if (a>=0)
{
Par.ParCommand(8, (7 << 24) + 1, a); // Adds "Italic"
Par.ParCommand(8, (6 << 24) + 0, a); // Removes "Bold"
p = (a >> 16) + (a & 0xFFFF); // Calculate Next position
}
}
}
This code is used to start the process:
IWPMemo Memo = wpdllInt1.Memo;
Memo.EnumParagraphs(false, 1);
wpdllInt1.Memo.ReformatAll();
Category