prakashra
prakashra

Reputation: 11

List of objects in front of an object in PowerPoint using VSTO

There are few shape objects in a PowerPoint slide. The rectangle, ellipse, parallelogram, triangle and pentagon were drawn in that order meaning rectangle is at the back of all objects.

When iterating through the objects in PowerPoint, is it possible to get a list of all objects that lie in front/behind of an object and fall partially or fully within it. There may be a lot of objects in the PowerPoint and comparing each object against each object is a not a favorable solution.

I would like to get the list of objects(in this case - ellipse, parallelogram and triangle) against the rectangle. How can I achieve that programmatically using VSTO?

Source PowerPoint slide

Upvotes: 0

Views: 199

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

The PowerPoint object model provides the Shape.AutoShapeType property which returns or sets the shape type for the specified Shape object, which must represent an AutoShape other than a line, freeform drawing, or connector. So, you may use something like that:

If ActivePresentation.Slides(1).Shapes(1).Type = msoAutoShape Then
  If ActivePresentation.Slides(1).Shapes(1).AutoShapeType = msoShapeOval Then
    'Do something here
  End If
End If

Upvotes: 0

Related Questions