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 certain text part from the collection.
Syntax
GetItem()
Gets the text part with the input focus.
public object GetItem();Public Function GetItem() As ObjectGetItem(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);Public Function GetItem(ByRef clientOffset As Point) As Object| Parameter | Description |
|---|---|
| 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);Public Function GetItem(location As Point, ByRef clientOffset As Point) As Object| Parameter | Description |
|---|---|
| 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}");Dim textPartCollection As TextPartCollection = textControl.TextParts
Dim result = textPartCollection.GetItem()
Console.WriteLine($"Get Item result: {result}")