简体   繁体   中英

How to get the collection of all shapes in a powerpoint document?

I wonder if there is a way to get the collection of all shapes in a PowerPoint document analogous to Document.Shapes in Word.

According to MSDN https://msdn.microsoft.com/en-us/library/office/ff746621.aspx

Use the Shapes property to return the Shapes collection. The following example selects all the shapes in the active presentation.

ActivePresentation.Slides(1).Shapes.SelectAll

But this will give me the Shapes only of the first Page/Slide, I think.

No. Word and PowerPoint are different beasts with different workflows. With ActivePresentation.Slides(1).Shapes, you will only get the shapes associated with the specfied slide.

As suggested you will need to iterate through the slide deck to create your own global list of shapes in PowerPoint.

the solution for me was:

  var allShapes = Application.GetActiveInstance().ActivePresentation.Slides.Range().Shapes;

It gives me back all Shapes of the PowerPoint presentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM