UI Automation Text Attributes
This topic describes how Microsoft UI Automation exposes the format and style properties (text attributes) of textual content, and provides a list of supported text attributes.
UI Automation providers expose text attributes through the GetAttributeValue and FindAttribute methods of the TextRange control pattern. Client applications use the IUIAutomationTextRange::GetAttributeValue method to retrieve the value of a particular text attribute for a text range. Clients can use the IUIAutomationTextRange::FindAttribute method to search a text range for text that has a particular attribute. If any matching text is found, the method creates a new text range that contains the matching text.
The text attributes in the following list are supported by the TextRange control pattern. The attribute names are derived from the UI Automation text attribute identifiers. For example, the AnimationStyle attribute is identified by clients as UIA_AnimationStyleAttributeId (defined in Uiautomationclient.h) and by providers as Text_AnimationStyle_Attribute_GUID (defined in Uiautomationcoreapi.h). For more information about each supported text attribute, see Text Attribute Identifiers.
Note
Some of the attributes listed are supported starting with Windows 8. See Text Attribute Identifiers for notes regarding version support.
This topic contains the following sections:
- Annotation Attributes
- Font Attributes
- Language Attributes
- Link Attribute
- Page Margin Attributes
- Text Alignment Attributes
- Text Color Attributes
- Text Decoration Attributes
- Text Style Attributes
- Interaction and Selection Attributes
- Related topics
Annotation Attributes
Annotation objects and annotation types are available through the following attributes.
Attribute | Identifier |
---|---|
AnnotationObjects | UIA_AnnotationObjectsAttributeId |
AnnotationTypes | UIA_AnnotationTypesAttributeId |
Font Attributes
The name, size, and weight of a font is available through the following attributes.
Attribute | Identifier |
---|---|
FontName | UIA_FontNameAttributeId |
FontSize | UIA_FontSizeAttributeId |
FontWeight | UIA_FontWeightAttributeId |
Language Attributes
Information about the language of the text is available through the following attributes.
Attribute | Identifier |
---|---|
Culture | UIA_CultureAttributeId |
TextFlowDirections | UIA_TextFlowDirectionsAttributeId |
Link Attribute
The following attribute provides the text range that is the target of a link in a document.
Attribute | Identifier |
---|---|
Link | UIA_LinkAttributeId |
Page Margin Attributes
The bounding rectangles of a text range do not expose the coordinates of the text in the page. However, a provider can expose the page margin information using the following text attributes.
Attribute | Identifier |
---|---|
MarginBottom | UIA_MarginBottomAttributeId |
MarginLeading | UIA_MarginLeadingAttributeId |
MarginTop | UIA_MarginTopAttributeId |
MarginTrailing | UIA_MarginTrailingAttributeId |
Text Alignment Attributes
Information about text alignment such as indentation, tab settings, and horizontal alignment is available through the following attributes.
Attribute | Identifier |
---|---|
HorizontalTextAlignment | UIA_HorizontalTextAlignmentAttributeId |
IndentationFirstLine | UIA_IndentationFirstLineAttributeId |
IndentationLeading | UIA_IndentationLeadingAttributeId |
IndentationTrailing | UIA_IndentationTrailingAttributeId |
Tabs | UIA_TabsAttributeId |
Text Color Attributes
The foreground and background text colors are available through the following text attributes. Both colors are specified as a COLORREF data type.
Attribute | Identifier |
---|---|
BackgroundColor | UIA_BackgroundColorAttributeId |
ForegroundColor | UIA_ForegroundColorAttributeId |
Text Decoration Attributes
Text decorations include areas such as bullets, underlining, and animations. If text includes leading bullets or numbers, the symbol or text used for the bullet or number should be included in the text stream, if applicable.
Information about text decorations is available through the following attributes.
Attribute | Identifier |
---|---|
AnimationStyle | UIA_AnimationStyleAttributeId |
BulletStyle | UIA_BulletStyleAttributeId |
OutlineStyles | UIA_OutlineStylesAttributeId |
OverlineColor | UIA_OverlineColorAttributeId |
OverlineStyle | UIA_OverlineStyleAttributeId |
StrikethroughColor | UIA_StrikethroughColorAttributeId |
StrikethroughStyle | UIA_StrikethroughStyleAttributeId |
UnderlineColor | UIA_UnderlineColorAttributeId |
UnderlineStyle | UIA_UnderlineStyleAttributeId |
Text Style Attributes
Information about text styles is available though the following attributes.
Attribute | Identifier |
---|---|
CapStyle | UIA_CapStyleAttributeId |
IsHidden | UIA_IsHiddenAttributeId |
IsItalic | UIA_IsItalicAttributeId |
IsReadOnly | UIA_IsReadOnlyAttributeId |
IsSuperscript | UIA_IsSuperscriptAttributeId |
IsSubscript | UIA_IsSubscriptAttributeId |
Interaction and Selection Attributes
Information about current text selection in the range and focus state is available though the following attributes.
Attribute | Identifier |
---|---|
IsActive | UIA_IsActiveAttributeId |
SelectionActiveEnd | UIA_SelectionActiveEndAttributeId |
CaretPosition | UIA_CaretPositionAttributeId |
CaretBidiMode | UIA_CaretBidiModeAttributeId |
Related topics
-
Conceptual