SubTextPart Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WPF. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WPF. SDK TXTextControl.from the setup.dll
Description
A SubTextPart object represents a user-defined part of a TX Text Control document. A TX Text Control document consists of the main text, and additionally other pieces of text such as text frames and headers or footers, called textparts. A programmer can define further parts called subtextparts to perform operations on smaller pieces of text. Each of the main textparts has a SubTextPartCollection which can be used to add and remove subtextparts or to save the subtextpart's text.
Syntax
public class SubTextPartPublic Class SubTextPartExamples
The following example marks the selected customer name as a named document region.
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
SubTextPart subTextPart = new("CustomerName", 10);
textControl.SubTextParts.Add(subTextPart);textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim subTextPart As New SubTextPart("CustomerName", 10)
textControl.SubTextParts.Add(subTextPart)Members
Constructors
| Constructor | Description |
|---|---|
| SubTextPart | Initializes a new instance of the SubTextPart class. |
Properties
| Property | Description |
|---|---|
| Data | Gets or sets additional data of the subtextpart. An empty string indicates that the subtextpart has no data. |
| HighlightColor | Gets or sets the highlight color for the subtextpart. A subtextpart is highlighted, if it contains the current text input position. The color's alpha value must be less than 255 (opaque) so that the textpart's text remains visible. The default value is red with an alpha value of 60. |
| HighlightMode | Gets or sets a value indicating when the subtextpart is highlighted. |
| ID | Gets or sets the subtextpart's identifier. It must be a one-based value. A value of zero indicates that the subtextpart has no identifier. |
| Length | Gets the number of characters which belong to the subtextpart. |
| Name | Gets or sets the name of the subtextpart. An empty string indicates that the subtextpart has no name. |
| NestedLevel | Gets the subtextpart's nested level. The top level is 1. |
| Number | Gets the subtextpart's number. The first subtextpart has the number 1. The number is defined through the textflow. A textpart with a smaller start position has a smaller number. When an outer subtextpart has the same start position than one of its nested textparts the outer textpart has a smaller number. |
| OuterMostSubTextPart | Gets a subtextpart's outermost subtextpart. This is a top-level subtextpart with a nested level of 1. The property's value is an object of the type SubTextPart or null if this subtextpart is already a top-level subtextpart. |
| OuterSubTextPart | Gets a subtextpart's outer subtextpart. The property's value is an object of the type SubTextPart or null if this subtextpart is a top-level subtextpart. |
| Start | Gets the index (one-based) of the first character which belongs to the subtextpart. |
| Text | Gets the subtextpart's text. |
Methods
| Method | Description |
|---|---|
| GetChildren | Returns an array of SubTextPart objects which are the children of this SubTextPart. The array contains all direct children and all further descendants in the order as they appear in the text. |
| GetTextFields | Returns an array of TextField objects which are completely contained in this SubTextPart. The objects' type depend on the fieldType parameter. |
| Save | Saves the subtextpart's text with the specified format. |
| ScrollTo | Sets the current input position to the beginning of a subtextpart and scrolls it into the visible part of the document. |