Word with UIA: Retrieve Page Numbers from Custom Attributes API (#19386) (#19394)
Fixes #19386
Summary of the issue:
When using UIA to access Microsoft Word documents, page change announcements do not occur when navigating between table rows that span different pages. Page changes are only announced after exiting the table. This does not occur in IAccessible mode ("only where necessary" setting), where page changes are announced correctly within tables.
Description of user facing changes:
When navigating table rows in Word documents using UIA, NVDA will now correctly announce page changes (e.g., "page 2") when moving between rows on different pages.
Description of developer facing changes:
Description of development approach:
The WordDocumentTextInfo._getFormatFieldAtRange method now retrieves page numbers via Word's custom attribute API (UIACustomAttributeID.PAGE_NUMBER), similar to how line numbers and section numbers are already retrieved. The fallback mechanism in getTextWithFields has been updated to only propagate page numbers from control elements when UIARemote is not supported, preserving the more accurate custom attribute values.