TX Text Control .NET for Windows Forms

Add Method

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

Description

Adds a new table of contents to the document at the current text input position.

Syntax

public TableOfContentsCollection.AddResult Add(TableOfContents tableOfContent);

Parameters

ParameterDescription
tableOfContent

Specifies the table of contents to add.

Return Value

The return value specifies whether the new table of contents has successfully been inserted. It can be one of the TableOfContentsCollection.AddResult values.

Examples

The following example works with tables of contents in the current document by using TableOfContentsCollection.Add.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
TableOfContentsCollection tableOfContentsCollection = textControl.TablesOfContents;

var result = tableOfContentsCollection.Add(new TableOfContents(10, 10));
Console.WriteLine($"Add result: {result}");