Skip to content

Excel: fix comments/formulas listing (NVDA+f7) on some non-English systems#17720

Merged
seanbudd merged 2 commits into
nvaccess:masterfrom
CyrilleB79:fixExcelCommentList2
Feb 26, 2025
Merged

Excel: fix comments/formulas listing (NVDA+f7) on some non-English systems#17720
seanbudd merged 2 commits into
nvaccess:masterfrom
CyrilleB79:fixExcelCommentList2

Conversation

@CyrilleB79

@CyrilleB79 CyrilleB79 commented Feb 21, 2025

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #11366

Summary of the issue:

In an Excel sheet, when comments or formulas are located in non-contiguous cells (i.e. most of the time), listing them in the elements dialog (NVDA+f7) fails on some non-English systems.
It's because the range containing the addresses of the cells of interest are retrieved in native (English) format whereas the call to application.range in cpp code expects a locale aware version of the range's address to retrieve the cells content. The two formats differ one from another because they do not use the same list separator: "," in English / ";" in some other languages such as French (where "," is already the decimal separator).

Description of user facing changes

Excel will no longer fail to list formulas/comments in its elements dialog on some non-English systems for non-contiguous cells.

Description of development approach

In a first attempt, I added one extra loop to retrieve the content for each area separately; however, calling NVDA helper many times may lead to numerous cross-process calls causing delays.

Finally, (thanks to @michaelDCurran), I have converted the native (English) address range before passing it to NVDA helper which calls application.range().

Testing strategy:

Manual test for comments, formulas in non-contiguous cells.
Tested on French system with:

  • Excel 2021 LTSC (Microsoft® Excel® LTSC MSO (16.0.14332.20824) 64 bits)
  • Excel 2016 (Microsoft® Excel® 2016 MSO (Version 2501 Build 16.0.18429.20132) 32 bits)

If someone wants to test on other office versions (e.g. 365, or older ones) feel free to provide feedback. Thanks.

Known issues with pull request:

None

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

@CyrilleB79 CyrilleB79 marked this pull request as ready for review February 23, 2025 20:48
@CyrilleB79 CyrilleB79 requested a review from a team as a code owner February 23, 2025 20:48
@seanbudd

Copy link
Copy Markdown
Member

Pending triage of #11366

seanbudd
seanbudd previously approved these changes Feb 25, 2025

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good, pending triage/example to test with

Comment thread user_docs/en/changes.md Outdated
Comment thread source/NVDAObjects/window/excel.py Outdated
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

@seanbudd thanks for your review.

Regarding triage / repro, see #11366 (comment).

@seanbudd seanbudd dismissed their stale review February 25, 2025 23:48

approach needs reconsideration

@seanbudd seanbudd added blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases. and removed blocked/needs-sample labels Feb 25, 2025
@CyrilleB79 CyrilleB79 changed the title Excel: fix comments/formulas listing (NVDA+f7) when they are in non-contiguous cells Excel: fix comments/formulas listing (NVDA+f7) on some non-English systems Feb 26, 2025
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

Many thanks @michaelDCurran, your intuition (#11366 (comment)) was correct!
I have now turned back to a single call to NVDA remote helper.

3 similar comments
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

Many thanks @michaelDCurran, your intuition (#11366 (comment)) was correct!
I have now turned back to a single call to NVDA remote helper.

@CyrilleB79

Copy link
Copy Markdown
Contributor Author

Many thanks @michaelDCurran, your intuition (#11366 (comment)) was correct!
I have now turned back to a single call to NVDA remote helper.

@CyrilleB79

Copy link
Copy Markdown
Contributor Author

Many thanks @michaelDCurran, your intuition (#11366 (comment)) was correct!
I have now turned back to a single call to NVDA remote helper.

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CyrilleB79 - approach looks great

@seanbudd seanbudd merged commit d75a3fb into nvaccess:master Feb 26, 2025
@github-actions github-actions Bot added this to the 2025.1 milestone Feb 26, 2025
@CyrilleB79 CyrilleB79 deleted the fixExcelCommentList2 branch February 27, 2025 13:24
numCellsFetched = ctypes.c_long()
address = collectionObject.address(True, True, xlA1, True)
sep = worksheet.Application.International(XlApplicationInternational.LIST_SEPARATOR)
localeAwareAddress = address.replace(",", sep)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the address contains the file name and sheet name, replacing the commas like this will mangle the file or sheet names if they happen to contain a comma, which Excel definitely allows.
E.g.

'[test, ding.xlsx]ding, dong'!$A$1

At very least, you need to split on the exclamation mark (!) and only replace the commas after that point.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @michaelDCurran for noting this! I have opened #17754 to fix it up in a more robust way, at least I hope so...

CyrilleB79 pushed a commit to CyrilleB79/nvda that referenced this pull request Feb 28, 2025
seanbudd pushed a commit that referenced this pull request Mar 3, 2025
Fix-up of #17720

Summary of the issue:
#17720 fixed Excel element list dialog on non-English system, using the local list separator to request a range. Though, the way it was implemented could fail in case the Excel file or sheet names also contained a comma.

Description of user facing changes
Listing comments or formulas in Excel no longer fails when the name of the file or the sheet contains a comma.

Description of development approach
Split the range string on the last "!" character to isolate the cells range from the file/sheet names.
Replace the separator only in the cells range part.
Testing strategy:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked/needs-product-decision A product decision needs to be made. Decisions about NVDA UX or supported use-cases.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Excel - Listing the comments in the current sheet fails

3 participants