OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
641 stars 92 forks source link

Request for a Union method for Excel #4404

Closed hugo082 closed 1 week ago

hugo082 commented 3 weeks ago

In the VBA Object library, the Application object has a Union method. This method allows one to easily gather (non-)contiguous ranges into one collection. The Union method is smart enough to build contiguous ranges where possible (it creates one range A1:A10 if passed cells A1 to A10 in any order).

The office-js object library does not expose a Union method in the Excel context and it would be a welcome addition. For example when creating an application that searches for a string in all formulas of a sheet.

If we use the findAll method of the worksheet object, office-js reports all found cells individually, potentially resulting in many single cells.

Using the Union method one could build contiguous ranges of cells that share the same formulaR1C1. This way we can prevent reporting hundreds or even thousands of single cells to the user and summarize found items into their contiguous ranges containing a "copied" formula.

In VBA, Union is a very efficient way to first collect blocks of contiguous ranges prior to doing an operation on in one command, such as changing their formatting. I expect this may apply to office-js as well.

Original request on the Microsoft tech community

SiruiSun-MSFT commented 2 weeks ago

Hi @hugo082, thanks for your feedback here! We have already opened an internal feature ask #8942322 to track this request. And we will consider the request list when we go through our planning process.

microsoft-github-policy-service[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

microsoft-github-policy-service[bot] commented 1 week ago

This issue has been closed due to inactivity. Please comment if you still need assistance and we'll re-open the issue.