Clear Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Removes all page number fields contained in the collection from the document.
Syntax
public void Clear(bool keepText);Public Sub Clear(keepText As Boolean)Parameters
| Parameter | Description |
|---|---|
| keepText | If this parameter is set to true, all page number fields are removed without deleting their texts. Otherwise, the texts are also deleted. |
Examples
The following example removes all page-number fields while preserving their displayed text before rebuilding the footer.
textControl.HeadersAndFooters.Add(HeaderFooterType.Footer);
HeaderFooter footer = textControl.HeadersAndFooters.GetItem(HeaderFooterType.Footer);
PageNumberFieldCollection fields = footer.PageNumberFields;
fields.Add(new PageNumberField());
fields.Clear(true);textControl.HeadersAndFooters.Add(HeaderFooterType.Footer)
Dim footer As HeaderFooter = textControl.HeadersAndFooters.GetItem(HeaderFooterType.Footer)
Dim fields As PageNumberFieldCollection = footer.PageNumberFields
fields.Add(New PageNumberField())
fields.Clear(True)