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.

Method Description
IUIAutomationTextRange::AddToSelection Adds the text range to the collection of selected text ranges in a control that supports multiple, disjoint spans of selected text.
IUIAutomationTextRange::Clone Retrieves a new IUIAutomationTextRange identical to the original and inheriting all properties of the original.
IUIAutomationTextRange::Compare Retrieves a value that specifies whether this text range has the same endpoints as another text range.
IUIAutomationTextRange::CompareEndpoints 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.
IUIAutomationTextRange::ExpandToEnclosingUnit 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::FindAttribute Retrieves a text range subset that has the specified text attribute value.
IUIAutomationTextRange::FindText Retrieves a text range subset that contains the specified text.
IUIAutomationTextRange::GetAttributeValue Retrieves the value of the specified text attribute across the entire text range.
IUIAutomationTextRange::GetBoundingRectangles Retrieves a collection of bounding rectangles for each fully or partially visible line of text in a text range.
IUIAutomationTextRange::GetChildren Retrieves a collection of all embedded objects that fall within the text range.
IUIAutomationTextRange::GetEnclosingElement Returns the innermost UI Automation element that encloses the text range.
IUIAutomationTextRange::GetText Returns the plain text of the text range.
IUIAutomationTextRange::Move Moves the text range forward or backward by the specified number of text units .
IUIAutomationTextRange::MoveEndpointByRange Moves one endpoint of the current text range to the specified endpoint of a second text range.
IUIAutomationTextRange::MoveEndpointByUnit Moves one endpoint of the text range the specified number of text units within the document range.
IUIAutomationTextRange::RemoveFromSelection Removes the text range from an existing collection of selected text in a text container that supports multiple, disjoint selections.
IUIAutomationTextRange::ScrollIntoView Causes the text control to scroll until the text range is visible in the viewport.
IUIAutomationTextRange::Select Selects the span of text that corresponds to this text range, and removes any previous selection.


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