ITextRangeProvider 介面


公開方法與屬性,以支援使用者介面自動化用戶端在實作 ITextProvider 的文字容器中存取一段連續的文字。Exposes methods and properties to support UI Automation client access to a span of continuous text in a text container that implements ITextProvider.

public interface class ITextRangeProvider
public interface ITextRangeProvider
public interface ITextRangeProvider
type ITextRangeProvider = interface
type ITextRangeProvider = interface
Public Interface ITextRangeProvider


在必須支援控制項模式的消費者介面自動化提供者上執行 TextPatternImplemented on a UI Automation provider that must support the TextPattern control pattern.

TextPatternRange可以表示容器中的插入點、子集或所有文字 TextPatternA TextPatternRange can represent an insertion point, a subset, or all of the text in a TextPattern container.



加入至文字容器中反白的文字集合,此容器支援多次斷續選取。Adds to the collection of highlighted text in a text container that supports multiple, disjoint selections.


傳回新的 ITextRangeProvider,與原始 ITextRangeProvider 相同且繼承其所有屬性。Returns a new ITextRangeProvider identical to the original ITextRangeProvider and inheriting all properties of the original.


傳回的值表示文字範圍的擴展 (Start 端點至 End 端點) 與另一個文字範圍是否相同。Returns a value that indicates whether the span (the Start endpoint to the End endpoint) of a text range is the same as another text range.

CompareEndpoints(TextPatternRangeEndpoint, ITextRangeProvider, TextPatternRangeEndpoint)

傳回的值指定兩個文字範圍是否有相同的端點。Returns a value that specifies whether two text ranges have identical endpoints.


將文字範圍擴展至指定的文字單元。Expands the text range to the specified text unit.

FindAttribute(Int32, Object, Boolean)

傳回具有指定之屬性值的文字範圍子集。Returns a text range subset that has the specified attribute value.

FindText(String, Boolean, Boolean)

傳回包含指定文字的文字範圍子集。Returns a text range subset that contains the specified text.


從整個文字範圍中擷取指定屬性的值。Retrieves the value of the specified attribute across the text range.


對文字範圍中每一個完整或部分可見的文字行,擷取週框的集合。Retrieves a collection of bounding rectangles for each fully or partially visible line of text in a text range.


擷取文字範圍內所有內嵌物件的集合。Retrieves a collection of all embedded objects that fall within the text range.


傳回圍住文字範圍的最內層控制項。Returns the innermost control that encloses the text range.


擷取範圍的純文字。Retrieves the plain text of the range.

Move(TextUnit, Int32)

將文字範圍移動指定的文字單元數。Moves the text range the specified number of text units.

MoveEndpointByRange(TextPatternRangeEndpoint, ITextRangeProvider, TextPatternRangeEndpoint)

將文字範圍的一個端點移至第二個文字範圍上指定的端點。Moves one endpoint of a text range to the specified endpoint of a second text range.

MoveEndpointByUnit(TextPatternRangeEndpoint, TextUnit, Int32)

在文件範圍內,將文字範圍的一個端點移動指定的文字單元數。Moves one endpoint of the text range the specified number of text units within the document range.


從支援多次斷續選取的文字容器中反白的文字集合,移除反白的文字區段,此區段對應至呼叫端的 StartEnd 端點。Removes a highlighted section of text, corresponding to the caller's Start and End endpoints, from the collection of highlighted text in a text container that supports multiple, disjoint selections.


導致文字控制項垂直捲動,直到在檢視區看到文字範圍為止。Causes the text control to scroll vertically until the text range is visible in the viewport.


反白文字控制項的文字,此文字對應至文字範圍的 StartEnd 端點。Highlights text in the text control corresponding to the text range Start and End endpoints.