TX Text Control .NET for WPF

Clear Method

Method|Introduced in 13.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Removes all page number fields contained in the collection from the document.

Syntax

public void Clear(bool keepText);

Parameters

ParameterDescription
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);