DocumentTarget Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WinForms. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WinForms. SDK TXTextControl.from the setup.dll
Description
The DocumentTarget class represents a text position in a Text Control document that can be a target of a document link or a bookmark. For more information see the technical article Text Fields and Hypertext Links.
Syntax
public class DocumentTargetPublic Class DocumentTargetExamples
The following example shows how to insert a DocumentTarget and a corresponding DocumentLink into a document.
textControl1.ViewMode = TXTextControl.ViewMode.PageView;
textControl1.Text = "Page 1\fPage 2\fPage 3";
textControl1.Select(3, 0);
TXTextControl.DocumentTarget newTarget = new TXTextControl.DocumentTarget("Page1");
textControl1.DocumentTargets.Add(newTarget);
textControl1.InputPosition = new TXTextControl.InputPosition(2, 1, 3);
TXTextControl.DocumentLink newLink = new TXTextControl.DocumentLink("Jump to page 1", newTarget);
textControl1.DocumentLinks.Add(newLink);TextControl1.ViewMode = TXTextControl.ViewMode.PageView
TextControl1.Text = "Page 1" + Chr(12) + "Page 2" + Chr(12) + "Page 3"
TextControl1.Select(3, 0)
Dim newTarget As TXTextControl.DocumentTarget = New TXTextControl.DocumentTarget("Page1")
TextControl1.DocumentTargets.Add(newTarget)
TextControl1.InputPosition = New TXTextControl.InputPosition(2, 1, 3)
Dim newLink As TXTextControl.DocumentLink = New TXTextControl.DocumentLink("Jump to page 1", newTarget)
TextControl1.DocumentLinks.Add(newLink)The following example creates a named destination for an internal document link.
DocumentTarget documentTarget = new("CustomerDetails");
textControl.DocumentTargets.Add(documentTarget);Dim documentTarget As New DocumentTarget("CustomerDetails")
textControl.DocumentTargets.Add(documentTarget)Members
Constructors
| Constructor | Description |
|---|---|
| DocumentTarget | Creates a new instance of the DocumentTarget class. |
Properties
| Property | Description |
|---|---|
| AutoGenerationType | Gets the type of auto-generation. A document target which is the target of an entry in a table of contents is automatically generated when the table of contents is inserted into the document. |
| Bounds | Gets the bounding rectangle of a target. The bounding contains the top left and the bottom right coordinate of the text input position the target belongs to. The rectangle is given in twips with an origin at the upper left corner of the document. the left and the right coordinate are the same value. |
| ContainsInputPosition | Returns true, if the target's position is the same as the current text input position. |
| Deleteable | Specifies whether the target can be deleted by the end-user while the document is being edited. The default setting of this property is true. |
| ID | Gets or sets an identifier for the document target. This identifier can be used to uniquely identify the target. |
| Name | Relates a user-defined name to a target, that can be any kind of text in addition to the target's TargetName. |
| Number | Not described in the reference. public int Number { get; } |
| Start | Gets the character position (one-based) of the target. The target's position is at the left edge of this character. |
| TargetName | Gets or sets the target name. |
Methods
| Method | Description |
|---|---|
| ScrollTo | Sets the current text input position to the target's position and scrolls it into the visible part of the document. |