Clear Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. Core. SDK TXTextControl.from the private NuGet feed or Text Control Offline PackagesCore. dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.dll
Description
Removes all text fields from a Text Control 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 text fields are removed without deleting their texts. Otherwise, the texts are also deleted. |
Examples
The following example works with text fields in the current document by using TextFieldCollection.Clear.
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
TextFieldCollection textFieldCollection = textControl.TextFields;
textFieldCollection.Add(new ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", new[] { "CustomerName" }) { ID = 100 });
if (textFieldCollection.Count > 0)
{
textFieldCollection.Clear(true);
}textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim textFieldCollection As TextFieldCollection = textControl.TextFields
textFieldCollection.Add(New ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", New String() { "CustomerName" }) With { .ID = 100 })
If textFieldCollection.Count > 0 Then
textFieldCollection.Clear(True)
End If