GetItem Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. Core. SDK TXTextControl.from the private NuGet feed or Text Control Offline PackagesCore. dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.dll
Description
Gets a particular table of contents from the collection.
Syntax
GetItem()
Gets the table of contents at the current text input position. If there is no table of contents, null is returned.
public TableOfContents GetItem();Public Function GetItem() As TableOfContentsGetItem(string)
Gets the table of contents with the specified name. The method returns null, if such a table of contents does not exist. If more than one table of contents with this name exists, the first found table of contents is returned.
public TableOfContents GetItem(string name);Public Function GetItem(name As String) As TableOfContents| Parameter | Description |
|---|---|
| name | Specifies the name set with the Name property. The method returns null if a table of contents with the specified name does not exist. |
GetItem(int)
Gets the table of contents with the specified id. The method returns null, if such a table of contents does not exist. If more than one table of contents with this id exists, the first found table of contents is returned.
public TableOfContents GetItem(int id);Public Function GetItem(id As Integer) As TableOfContents| Parameter | Description |
|---|---|
| id | Specifies the identifier of the table of contents. The method returns null if a table of contents with the specified identifier does not exist. |
Return Value
The return value is null, if a table of contents with the specified parameters could not be found. Otherwise, it is an object of the type TableOfContents.
Examples
The following example works with tables of contents in the current document by using TableOfContentsCollection.get_Item.
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
TableOfContentsCollection tableOfContentsCollection = textControl.TablesOfContents;
tableOfContentsCollection.Add(new TableOfContents(1, 3) { Name = "Contents", ID = 100 });
TableOfContents result = tableOfContentsCollection.GetItem(100);
result?.ScrollTo();textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim tableOfContentsCollection As TableOfContentsCollection = textControl.TablesOfContents
tableOfContentsCollection.Add(New TableOfContents(1, 3) With { .Name = "Contents", .ID = 100 })
Dim result As TableOfContents = tableOfContentsCollection.GetItem(100)
If result IsNot Nothing Then result.ScrollTo()