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
677 stars 95 forks source link

Reapplying an excel table's sort causes a general exception when there's two workbooks open #2676

Open Stepan-Valkov opened 2 years ago

Stepan-Valkov commented 2 years ago

Your Environment

Expected behavior

Table.sort.reapply() call reapplies sorting as expected even if there are several workbooks open.

Current behavior

When table.sort.reapply() is called for a table in a workbook that is not currently active, the following exception is thrown: GeneralException RichApi.Error: There was an internal error while processing the request. I expected it to work normally (to reapply the sort)

Steps to reproduce

  1. Create an excel table with any sorting
  2. Open another workbook
  3. Call table.sort.reapply() for your table while the focus is in the second workbook's window (e.g. using a delay like it's done in the gist below)

Link to live example(s)

Gist link: https://gist.github.com/Stepan-Valkov/6e5ed77441b469a56613af4296a19765

Provide additional details

Note that the second button has a built-in delay which should be enough for the tester to move focus from the workbook in question to an empty one

Context

Our excel add-in updates the data contained in excel tables constantly and we want to be able to sort it periodically, even if several workbooks are open

Useful logs

The exception isn't very verbose, but here's the stack trace: GeneralException RichApi.Error: There was an internal error while processing the request. at new n (https://appsforoffice.microsoft.com/lib/1/hosted/excel-win32-16.01.js:25:240171) at i.processRequestExecutorResponseMessage (https://appsforoffice.microsoft.com/lib/1/hosted/excel-win32-16.01.js:25:304337) at https://appsforoffice.microsoft.com/lib/1/hosted/excel-win32-16.01.js:25:302400

keyur32 commented 2 years ago

sorry was on vacation and didn't see this. Assigning to @yaweizhu-henson who drives Excel APIs. thx.

SiruiSun-MSFT commented 2 years ago

Hi @Stepan-Valkov , sorry for delay response. After investigation, it turned out that the bug is in Excel side when reapplying an excel table's sort (bug id: 6244801). We have contact Excel team and they are actively working on it. Unfortunately, I don't have a timeline to share at this point, but I will keep updated in this thread. Thanks!