Office.js API get selected shapes method for PowerPoint
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!
3 Comments
- FromTheArcticCopper Contributor
You can use the
context.presentation.getSelectedShapes();
See the sample https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/get-set-shapes.yaml 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.
- tjerkdbCopper Contributor
This is realy needed in order to create a meaningfull productivity add-in. Can the team give an update on this?
- FabienSinquinCopper 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).