TX Text Control .NET Server

GetItem Method

Method|Introduced in 15.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Gets a particular paragraph from the collection.

Syntax

GetItem(Point)

Gets the paragraph at a certain geometrical position.

public Paragraph GetItem(Point location);
ParameterDescription
location

Specifies the paragraph's location. The point must be specified in pixels with an origin at the top left corner of the control.

GetItem(int)

Gets the paragraph at a certain text input position.

public Paragraph GetItem(int textPosition);
ParameterDescription
textPosition

Specifies a zero-based text position.

Return Value

The return value is null, if a paragraph could not be found. Otherwise, it is an object of the type Paragraph.

Examples

The following example works with paragraphs in the current document by using ParagraphCollection.get_Item.

ParagraphCollection paragraphCollection = textControl.Paragraphs;
textControl.Text = "Quarterly results\nRevenue increased by 12%.";

Paragraph result = paragraphCollection.GetItem(new System.Drawing.Point(20, 20));
result?.Select();