Shape removal


#1

How would I go through a slide and delete any shapes that have text “!!!” (for example)

Everything I try while iterating through the shapes causes a crash. I understand why but I can’t come up with an alternative.


#2

for (int i = slide.Shapes.Count - 1; i >= 0; i–)
if (slide.Shapes[ i ].TextFrame != null)
slide.Shapes.Remove(i);

Sure, you have to check also GroupShapes recursively…


#3

Ahhhh, count backwards. I should have thought of that.

Thanks for doing my thinking for me.

John