Determine currently selected slide using PowerPoint API

Viewed 178

I am creating a PowerPoint addin using the JS-based Office Add-ins platform.

As demonstrated by getSelectedSlideIndex() from this sample, it is easy to determine the currently selected slide. Using Office.context.document.getSelectedDataAsync() with Office.CoercionType.SlideRange.

Having a slide it is also possible to obtain all contained shapes. For example:

const slide = context.presentation.slides.getItemAt(0);
const shape = slide.shapes.getItemAt(0);

Now I am looking for a way to determine which the currently selected shape is. (That is, the shape that the user clicked on last. The shape that would be removed when pressing DEL. Etc.) getSelectedDataAsync() has no appropriate coercion type parameter. Is there another method I can use?

2 Answers
Related