Office.js API get selected shapes method for PowerPoint

Office.js API get selected shapes method for PowerPoint
15

Upvotes

Upvote

 Nov 17 2021
3 Comments (3 New)
New

Hello!

In the current version, we can get selected data in PowerPoint/Excel/Word using `Office.context.document.getSelectedDataAsync`. However, this method can only work for some specific types of data such as `Office.CoercionType`.

In PowerPoint, `ShapeType` is a very important kind of data, I want to modify some selected shapes in slides. Maybe I missed some methods to get the selected shapes in PowerPoint, I would be appreciated if you have any ideas about that. I believe this is also really needed for developers.

Thank you so much in advance!
 

Comments
Copper Contributor

Office.CoercionType.Ooxml is rather convenient in Word to get and set formatted content.
I would love to be able to use it in PowerPoint (and I can think of use cases in Excel too).

Copper Contributor

This is realy needed in order to create a meaningfull productivity add-in. Can the team give an update on this?

Copper Contributor

You can use the 

context.presentation.getSelectedShapes();

See the sample https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/get-se... for more details. 

 

I got confused by this too as intuitively getting selected shapes sounds like it belongs in the getSelectedData method. Hope this helps.