IUIAutomationTextRange interface (uiautomationclient.h)

Provides access to a span of continuous text in a container that supports the IUIAutomationTextPattern interface. Client applications can use the IUIAutomationTextRange interface to select, compare, and retrieve embedded objects from the text span. The interface uses two endpoints to delimit where the text span starts and ends. Disjoint spans of text are represented by an IUIAutomationTextRangeArray interface.


The IUIAutomationTextRange interface inherits from the IUnknown interface. IUIAutomationTextRange also has these types of members:


The IUIAutomationTextRange interface has these methods.


Adds the text range to the collection of selected text ranges in a control that supports multiple, disjoint spans of selected text. (IUIAutomationTextRange.AddToSelection)

Retrieves a new IUIAutomationTextRange identical to the original and inheriting all properties of the original.

Retrieves a value that specifies whether this text range has the same endpoints as another text range. (IUIAutomationTextRange.Compare)

Retrieves a value that specifies whether the start or end endpoint of this text range is the same as the start or end endpoint of another text range.

Normalizes the text range by the specified text unit. The range is expanded if it is smaller than the specified unit, or shortened if it is longer than the specified unit. (IUIAutomationTextRange.ExpandToEnclosingUnit)

Retrieves a text range subset that has the specified text attribute value.

Retrieves a text range subset that contains the specified text.

Retrieves the value of the specified text attribute across the entire text range.

Retrieves a collection of bounding rectangles for each fully or partially visible line of text in a text range. (IUIAutomationTextRange.GetBoundingRectangles)

Retrieves a collection of all embedded objects that fall within the text range. (IUIAutomationTextRange.GetChildren)

Returns the innermost UI Automation element that encloses the text range.

Returns the plain text of the text range.

Moves the text range forward or backward by the specified number of text units .

Moves one endpoint of the current text range to the specified endpoint of a second text range. (IUIAutomationTextRange.MoveEndpointByRange)

Moves one endpoint of the text range the specified number of text units within the document range.

Removes the text range from an existing collection of selected text in a text container that supports multiple, disjoint selections.

Causes the text control to scroll until the text range is visible in the viewport.

Selects the span of text that corresponds to this text range, and removes any previous selection. (IUIAutomationTextRange.Select)


Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista, Windows XP with SP3 and Platform Update for Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008, Windows Server 2003 with SP2 and Platform Update for Windows Server 2008 [desktop apps only]
Target Platform Windows
Header uiautomationclient.h (include UIAutomation.h)

See also

Control Pattern Interfaces for Clients

UI Automation Support for Textual Content

Using Text Ranges