TX Text Control .NET Server

DocumentTarget Class

Class
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.Core.dll
Install
dotnet add package TXTextControl.TextControl.Core.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.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 DocumentTarget

Examples

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);

The following example creates a named destination for an internal document link.

DocumentTarget documentTarget = new("CustomerDetails");
textControl.DocumentTargets.Add(documentTarget);

Members

Constructors

ConstructorDescription
DocumentTargetCreates a new instance of the DocumentTarget class.

Properties

PropertyDescription
AutoGenerationTypeGets 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.
BoundsGets 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.
ContainsInputPositionReturns true, if the target's position is the same as the current text input position.
DeleteableSpecifies whether the target can be deleted by the end-user while the document is being edited. The default setting of this property is true.
IDGets or sets an identifier for the document target. This identifier can be used to uniquely identify the target.
NameRelates a user-defined name to a target, that can be any kind of text in addition to the target's TargetName.
NumberNot described in the reference. public int Number { get; }
StartGets the character position (one-based) of the target. The target's position is at the left edge of this character.
TargetNameGets or sets the target name.

Methods

MethodDescription
ScrollToSets the current text input position to the target's position and scrolls it into the visible part of the document.