TX Text Control .NET Server

GetItem Method

Method|Introduced in 16.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 certain text part from the collection.

Syntax

GetItem()

Gets the text part with the input focus.

public object GetItem();

GetItem(out Point)

Gets the text part with the input focus informing about the offset of the text part in the TextControl's client area.

public object GetItem(out Point clientOffset);
ParameterDescription
clientOffset

Retrieves the text part's offset, in pixels, in the TextControl's client area.

GetItem(Point, out Point)

Gets the text part at the specified geometric location.

public object GetItem(Point location, out Point clientOffset);
ParameterDescription
location

Specifies a location where to search for a text part. The point must be specified in pixels with an origin at the top left corner of the control.

clientOffset

Retrieves the text part's offset, in pixels, in the TextControl's client area.

Return Value

The return value is the found text part, which is either the text part with the input focus or the text part at the specified location. It can be an object of the type MainText, TextFrame, FootnoteSection or HeaderFooter. All of these objects implement the IFormattedText interface. The first and the second implementation return null, if there is no text part with the input focus. This can happen, if an image is selected, or if another application or component has the input focus.

Examples

The following example works with text parts in the current document by using TextPartCollection.GetItem.

TextPartCollection textPartCollection = textControl.TextParts;

var result = textPartCollection.GetItem();
Console.WriteLine($"Get Item result: {result}");