-
-
Notifications
You must be signed in to change notification settings - Fork 679
Report background and highlighting colors in Microsoft Word #5866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Given the recent work that has been done to improve MS Word support (#2961, #5800, #5946), I'd like to bring this ticket under attention again. @feerrenrut, mind assigning a priority to this? |
Requested the enhancement in Japan, regarding Microsoft Outlook as well. |
This would be really helpful. I hope it will come any time in the future into NVDA. |
Hi @LeonarddeR , I heavily played with UIA and VBA in recent days, around this situation. Imho, it's very confused even API side. Had you find a reliable way to distinguish between background and highlight color? I found only this property useful to be sure whether there is an highlighting and what's the color applied... |
I haven't played with this for years, so I have no idea honestly. |
Meanwhile I encountered problems with attached document, so i suspect the situation is changed from 2016, even in current Word support of these formatting in documents made with previous versions. However, Range.Shading.BackgroundPatternColor seems a good candidate to query for background. I'll continue to investigate, these seem to be things quite important in school, for teachers and students. |
Fixes #5866, fixes #7396, fixes #12101 Summary of the issue: In these years, Microsoft Word users working without UIA had no feedback about background and highlighting colors, often used by colleagues, teachers and students. UIA has provided a partial solution when available, but its support for these features is far from perfect (see later). Description of user facing changes Assuming UIA is not available/forcibly enabled: when color reporting is enabled in formatting preferences, users will hear background colors too; when marked/highlighted text reporting is enabled in formatting preferences, users will hear highlighting colors ("highlighted in {color}" and "no highlighting"), regardless of color reporting. Description of development approach It was very difficult to find a way, so I'll add some details. Initially, I used VBA objects approach, querying Paragraph.Shading.BackgroundPatternColor and Range.HighlightColorIndex over a winwordDocument.Range to calculate each time, so it was very slow. Then I found this document and, after having understood what I needed and how to find the required wdDISPID_ constants, I was able to move all work on the C++ component of nvdaHelperRemote related to winword, that appears very much faster. In window/winword.py, to take advantage of winwordColorToNVDAColor work, I added also a dict that collects indexes from wdColorIndex and decimal values from wdColor. About speech, I had to introduce a new format field, highlight-color. Now, UIA: sure, it already covers background and highlight colors, but expose them as the same attribute, via UIA_BackgroundColorAttributeId (and no, I asked, even visually they are distinct). There is an AnnotationType_Highlighted identifier, but it seems to not be used in this scenario. Locally I have a possible workaround, based on the fact that, as you see in Word Home menu, highlighting color is applied to characters, background color to paragraphs; so, if textRange has a background-color, I compare it to that retrieved from paragraph and, if I receive IUnknown/MixedAttributeValue, I assume the initial one is an highlighting color and try to get the real background color from "\r" EOL. But I'm not totally convinced, so I not included it in this PR for now.
I noticed that NVDA is unable to report background and highlighting color changes in Microsoft Word. Check the attachment for an example.
Steps to reproduce
Actual result: NVDA reports no difference
Proposed result: NVDA reports both background and highlighting color changes
The text was updated successfully, but these errors were encountered: