Upravit

Sdílet prostřednictvím


Accessing Spreadsheet Content

A text-based control that contains spreadsheet content can enable clients to access the content by supporting the Spreadsheet and SpreadsheetItem control patterns. This topic describes how Microsoft UI Automation client applications can access the content of a spreadsheet.

To determine whether a text-based control supports the Spreadsheet and SpreadsheetItem control patterns, first retrieve the IUIAutomationElement interface for the control (see Obtaining UI Automation Elements.) Next, call the IUIAutomationElement::GetCurrentPattern method, specifying a control pattern identifier of UIA_SpreadsheetPatternId or UIA_SpreadsheetItemPatternId, and a variant that receives TRUE if the control supports the particular control pattern.

To access the spreadsheet content, retrieve the IUIAutomationSpreadsheetPattern interface by calling IUIAutomationElement::GetCurrentPattern method and specifying UIA_SpreadsheetPatternId as the control pattern identifier. Next, use the IUIAutomationSpreadsheetPattern::GetItemByName method to get the IUIAutomationSpreadsheetItem interface for a particular spreadsheet item (typically a cell). Use the properties and methods of the IUIAutomationSpreadsheetItem interface to retrieve the formula for the cell, and any annotations associated with the cell. For more information about annotations, see Retrieving Annotations.

UI Automation Support for Textual Content

Working with Text-based Controls