Skip to content

Microsoft Word Highlighted text #7396

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

Closed
sharkboyto opened this issue Jul 14, 2017 · 12 comments · Fixed by #14610
Closed

Microsoft Word Highlighted text #7396

sharkboyto opened this issue Jul 14, 2017 · 12 comments · Fixed by #14610

Comments

@sharkboyto
Copy link

I,
form my work, I get from my colleges, different word processing documents. These documents (*.doc and *.docx), contain highlighted text and barred text .
I have important information about this text,but i can not understand by nvda, i do not use braille.

Can you put these features in nvda?

Thank you.

@ehollig
Copy link
Collaborator

ehollig commented Aug 4, 2017

If you turn on Font attributes and Style in the document formatting dialog, does this do what you would like?

@Adriani90
Copy link
Collaborator

@ehollig No, because you do not change the color or the font of the text, you just highlight the text with a certain color. Unfortunately NVDA does not report it while navigating. cc: @Qchristensen

@Qchristensen
Copy link
Member

I'm not sure what the original poster means by "barred" (possibly strikethrough? If so, then enabling "Font attributes" in NVDA's document formatting dialog will report this). It might be worth leaving this issue solely for highlight, and making a new issue if still required for "barred" text.

For highlighted text, Word does treat this differently to the font or background colour - NVDA does correctly read font and background colour. Highlight seems to go on top of the text and makes the background appear yellow (or whichever highlight colour is used) - similar to running a highlighter over a printed page. If you select the text and choose highlight again, it will remove the highlight.

Currently NVDA does not report highlight, although we'll need to check whether this is because Word isn't disclosing it, or whether NVDA isn't looking for it.

@Qchristensen Qchristensen changed the title Microsoft Word and text decoration: barred text and highlighted text! Microsoft Word Highlighted text Nov 18, 2019
@Qchristensen
Copy link
Member

Qchristensen commented Nov 18, 2019

Issue unchanged as at NVDA alpha-19159,cde557d5, Office 365 Version 16.0.12130.20344.

With NVDA"s "Use UI Automation for Word controls" setting enabled in the Advanced settings, NVDA does report the highlight colour as the "Background" colour, which is useful, though still not technically correct as the underlying background colour has not changed and if highlight is disabled, the original background colour is reinstated.

I also edited the original subject to remove the ambiguity:

Changed from "Microsoft Word and text decoration: barred text and highlighted text!" to "Microsoft Word Highlighted text". As noted in my previous comment, if the original person can clarify what "Barred text" is in a new issue, that can be dealt with separately.

@Adriani90
Copy link
Collaborator

cc: @mltony we had a short discussion in connection with your browsenav addon on NVDACon this year. Here is a related issue.

@mltony
Copy link
Contributor

mltony commented Nov 19, 2019

@Adriani90
I thought about this again, and it looks like I won't be able to implement this from within BrowserNav after all, since BrowserNav operates on paragraphs, while smaller than paragraph parts of text can be highlighted.
Therefore, if we'd want to implement "jump to next highlighted text" features, it would need to analyze all the characters one by one, which would be way too slow. Unless maybe there's a separate feature in MSWord that would do such a search on its side.

@Adriani90
Copy link
Collaborator

Hmm, maybe implementing a key stroke which allows navigating by highlighted text only in browse mode would be a possibility?
It should not be part of text navigation (character, paragraph etc). Maybe this would not impact performance significantly. What do you think?

In my case at least, this issue makes my day to day work really inefficient. I get big documents with highlighted text which I have to review and where only the highlighted text has to be changed or adjusted. So in a document with 200 pages you don't really want to read it line by line or paragraph by paragraph.

cc: @michaelDCurran

@mltony
Copy link
Contributor

mltony commented Feb 4, 2020 via email

@Qchristensen
Copy link
Member

Looking at a document now, NVDA does report highlighting as a text change colour (Bright yellow background) for me in Office 365 Version: 16.0.12730.20236 and NVDA 2020.1rc1. I'm not sure when this changed.

One way to find highlighted text is:

  1. Open the advanced find dialog. Press control+h.
  2. Press alt+m for "More" options
  3. Press alt+o for forma, then h for highlight.
  4. Press ENTER to find next.
  5. Press ESCAPE to close the find dialog.
  6. You can now use control+page down to find additional instances of highlighted text (or control+page up for previous instances).

(I'm not saying that's the most efficient solution to this issue, just that it works).

@Qchristensen
Copy link
Member

Another small update from a bit more testing:

In Office 365 currently (Office 365 (64-bit) Version: 16.0.13001.20338) there is an option for "Shading" in Word's Font options (it looks like it is hardcoded to grey).

There is also a "Shading" option in the paragraph options which lets you choose any colour.

Both these shading options, and highlighted text are reported by NVDA's "Color" option in document formatting options or NVDA+F. Interestingly the character shading option reports "White background" for me, even though (with standard settings) my text, which is normally black on white, is actually black on grey when I use that character shading.

To actually search (to find the next coloured text further down a document) it looks like you can only specifically search for "highlighted" text. You can search for text with a specific font colour, but not shading in Word.

@ABuffEr
Copy link
Contributor

ABuffEr commented Jan 12, 2023

Looking at a document now, NVDA does report highlighting as a text change colour (Bright yellow background) for me in Office 365 Version: 16.0.12730.20236 and NVDA 2020.1rc1. I'm not sure when this changed.

Hi @Qchristensen ,

using alpha-27459,816496f1, this is true only if you force UIA for Word document to always enabled, in Advanced settings.

But if the option is set to "Default (Where suitable)", then background color/highlighting is not reported in any way (not reading and neither checking with NVDA+f).

See also #5866 for a related issue and an example document.

P.S.: ah, I recognize the user and "barred" as a loan translation from Italian, I'd say you can consider as strikethrough :)

@Qchristensen
Copy link
Member

true only if you force UIA for Word document to always enabled

Ah thank you. I must not have noticed that.

I recognize the user and "barred" as a loan translation from Italian, I'd say you can consider as strikethrough :)

In that case, my earlier comment (and @ehollig's) should both address the "barred text" part of this request - turning on "font attributes" in NVDA's document formatting dialog will ensure NVDA reports strikethrough text.

seanbudd pushed a commit that referenced this issue Apr 4, 2023
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.
@nvaccessAuto nvaccessAuto added this to the 2023.2 milestone Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants