# DocumentTarget Class

> 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.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Class
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > DocumentTarget Class
- **1583 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/llms-full.txt

---

### 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

```csharp
public class DocumentTarget
```

```vbnet
Public Class DocumentTarget
```

### Examples

The following example shows how to insert a DocumentTarget and a corresponding DocumentLink into a document.

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

```vbnet
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.

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

```vbnet
Dim documentTarget As New DocumentTarget("CustomerDetails")
textControl.DocumentTargets.Add(documentTarget)
```

---

## In This Section

- [DocumentTarget.AutoGenerationType Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/autogenerationtype-property/llms-full.txt): 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.
- [DocumentTarget.Bounds Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/bounds-property/llms-full.txt): 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.
- [DocumentTarget Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/constructor/llms-full.txt): Creates a new instance of the DocumentTarget class.
- [DocumentTarget.ContainsInputPosition Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/containsinputposition-property/llms-full.txt): Returns true, if the target's position is the same as the current text input position.
- [DocumentTarget.Deleteable Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/deleteable-property/llms-full.txt): 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.
- [DocumentTarget.ID Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/id-property/llms-full.txt): Gets or sets an identifier for the document target. This identifier can be used to uniquely identify the target.
- [DocumentTarget.Name Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/name-property/llms-full.txt): Relates a user-defined name to a target, that can be any kind of text in addition to the target's TargetName.
- [DocumentTarget.ScrollTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/scrollto-method/llms-full.txt): Sets the current text input position to the target's position and scrolls it into the visible part of the document.
- [DocumentTarget.Start Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/start-property/llms-full.txt): Gets the character position (one-based) of the target. The target's position is at the left edge of this character.
- [DocumentTarget.TargetName Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/targetname-property/llms-full.txt): Gets or sets the target name.

---

## Nearby

- **Previous:** [DocumentSettings.UserDefinedDocumentProperties Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documentsettings/userdefineddocumentproperties-property/llms-full.txt)
- **Next:** [DocumentTarget.AutoGenerationType Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/autogenerationtype-property/llms-full.txt)
