【发布时间】:2010-08-24 15:05:44
【问题描述】:
我需要浏览 PowerPoint 2007 中智能艺术的每个形状。
当shape.Type=msoSmartArt 时,我可以简单地浏览 shape.GroupItems 中的形状。
但是,当shape.Type == msoPlaceholder && shape.PlaceholderFormat.ContainedType==msoSmartArt
然后shape.GroupItems 为空。在这种情况下如何访问 Smart Art 形状?
我以前认为 VBA 和 C# VSTO 基本相同。
嗯 - 这里有区别。我在实际的 VBA 中尝试了 Otaku 的代码,它似乎确实有效(抱歉,Otaku 混淆了)。
但是,我的程序是在 C# VSTO 中,并且:
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);
}
产生:shapes.Count=0(当形状类型为占位符,包含类型为 SmartArt 时)。
有什么想法吗?
【问题讨论】:
-
不是真的......但我确实将答案标记为有用,因为它在 VB 中有效。
标签: vba vsto powerpoint