[PowerPoint javascript API] Read selected shapes ids on the slide

[PowerPoint javascript API] Read selected shapes ids on the slide
4

Upvotes

Upvote

 Sep 21 2023
0 Comments 
New

Right now in our add-in we are using Office.context.document.getSelectedDataAsync to get information about the number of the currently selected slide, however as far as we know, it is not possible to use this function with 'CoercionType.Image'. We want to be able to get shapeId of selected object on DocumentSelectionChanged event and the only way of doing it is by calling context.presentation.getSelectedShapes(), loading items, syncing context, loading id for each shape and syncing again. This might be a performance issue if we decide to perform all these actions each time selection changes.

 

Is there any more efficient way of reading shapeId along with other properties from currently selected images?

 

use case: User wants to click an image on the slide to highlight corresponding object tile on the side panel in the add-in, it is not possible right now as we are not able to determine which object is currently selected