views:

61

answers:

1

I need to go through each shape of a smart-art in PowerPoint 2007. When shape.Type=msoSmartArt then I could simply go through the shapes in shape.GroupItems.

However, when shape.Type == msoPlaceholder && shape.PlaceholderFormat.ContainedType==msoSmartArt then shape.GroupItems is empty. How can I access the smart-art shapes in such a case?


I used to think of VBA and C# VSTO as basically the same.

Well - here there's a difference. I tried Otaku's code in actual VBA and it indeed seems to work (sorry for the confusion, Otaku).

However, my program is in C# Vsto, and:

foreach (Shape slideShape in pres.Slides[1].Shapes)
{
  if (slideShape.Type != MsoShapeType.msoSmartArt &&   !(slideShape.Type == MsoShapeType.msoPlaceholder &&  slideShape.PlaceholderFormat.ContainedType==MsoShapeType.msoSmartArt))
 continue;

 GroupShapes shapes=slideShape.GroupItems;
 Debug.WriteLine(shapes.Count);
}

Does produce: shapes.Count=0 (when the shape type is Placeholder, and containedtype is SmartArt).

Any ideas?

Thanks, Arie

A: 

The workaround I use is copying the SmartArt and pasting it back. the pasted SmartArt now has all its shapes in its GroupItems. After working with these, I delete the pasted shape.

Arie Livshin