0

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

prakashra
  • 11
  • 4

1 Answers1

0

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
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Thanks,I don't think this answers my query at all. I need those objects for that have non-zero intersection with the rectangle. If I have to compare every other object against the rectangle, it would be a solution; but not a good one. – prakashra Jun 21 '22 at 07:05
  • You can use Shape's properties to find out and intersection with others. – Eugene Astafiev Jun 21 '22 at 07:08
  • " If I have to compare every other object against the rectangle, it would be a solution; but not a good one." Perhaps not optimal, but it's the only way to do the job in PowerPoint. – Steve Rindsberg Jun 21 '22 at 14:50