Open NickRedwood opened 6 months ago
Thanks for reporting this @NickRedwood. I'm going to transfer it to the office-js repo and get a member of the Excel feature crew to take a look.
Thanks @AlexJerabek
I have found that the Excel.Shape
onActivated
and onDeactivated
methods work correctly for multiple selection, and I think I may be able to use those for Chart
, though yet to flesh that out. Unfortunately there is no onActivated
and onDeactivated
method on ShapeCollection
. No getActiveShapes
either, or onAdded
, onRemoved
.
Thank you @NickRedwood for raising the problem.
Thanks @dingjin-ms
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!
This issue has been closed due to inactivity. Please comment if you still need assistance and we'll re-open the issue.
Article URL On what page did you find the problem? https://learn.microsoft.com/en-us/javascript/api/excel/excel.chartcollection?view=excel-js-preview#excel-excel-chartcollection-ondeactivated-member
Describe the problem You have two charts on an Excel sheet and you add
onActivated
andonDeactivated
methods to either the individualChart
s or theChartCollection
, as in the linked example. If you click one chart thenonActivated
fires. If you then shift-click the second chart,onDeactivated
fires on the first chart, even though it is still active.I recently realised the web version of Excel (which I rarely use) does not allow multiple selection of charts or shapes, which I guess is the source of this problem. In desktop Excel though the current behaviour is not right. If it can't be fixed, a note in the documentation could be added.
The overall context is I'm trying to create an add-in to apply bulk formatting to charts, and was trying to use events to write my own version of
getActiveCharts
in the absence of a built-in method. There is only the singulargetActiveChart
.