TX Text Control .NET Server

GetTextFields Method

Method|Introduced in 29.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Returns an array of TextField objects which are completely contained in this SubTextPart. The objects' type depend on the fieldType parameter.

Syntax

public TextField[] GetTextFields(TextFieldType fieldType);

Parameters

ParameterDescription
fieldType

Specifies types of text fields. It can be a combination of the TextFieldType values.

Return Value

The return value is null if this SubTextPart has no textfields. Otherwise, it is an array of objects of the type specified through the fieldType parameter.

Examples

The following example marks the selected customer name as a named document region by using SubTextPart.GetTextFields.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
SubTextPart subTextPart = new("CustomerName", 10);
textControl.SubTextParts.Add(subTextPart);

TextField[] results = subTextPart.GetTextFields(TextFieldType.HypertextLink);
foreach (TextField textField in results)
{
    Console.WriteLine(textField);
}