Clear Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WPF. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Removes all fields of the type ApplicationField from a TX 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 fields are removed without deleting their visible text. Otherwise, the visible text is also deleted. |
Examples
The following example removes every application field while preserving each field's visible text.
textControl.Text = "Dear ,";
textControl.InputPosition = new InputPosition(5);
ApplicationFieldCollection fields = textControl.ApplicationFields;
ApplicationField customerField = new(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", new[] { "CustomerName" }) { ID = 100 };
fields.Add(customerField);
fields.Clear(true);textControl.Text = "Dear ,"
textControl.InputPosition = New InputPosition(5)
Dim fields As ApplicationFieldCollection = textControl.ApplicationFields
Dim customerField As New ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", New String() { "CustomerName" }) With { .ID = 100 }
fields.Add(customerField)
fields.Clear(True)