Shape

Shape(Presentation, ForEachShapeCallback)

迭代每个ShapePresentation中。 形状将在所有类型的幻灯片中迭代 -Slide,MasterSlideLayoutSlide

public static void Shape(Presentation pres, ForEachShapeCallback forEachShape)
范围类型描述
presPresentation表示迭代布局形状
forEachShapeForEachShapeCallback将为每个形状调用的回调

例子

using (Presentation pres = new Presentation("pres.pptx"))
{
    ForEach.Shape(pres, (shape, slide, index) => 
    {
        System.Console.WriteLine($"{shape.Name}, index: {index}");
    });
} 

也可以看看


Shape(BaseSlide, ForEachShapeCallback)

迭代每个ShapeBaseSlide中。 BaseSlide是ForEachSlideCallback),MasterSlideLayoutSlide

public static void Shape(BaseSlide baseSlide, ForEachShapeCallback forEachShape)
范围类型描述
baseSlideBaseSlide滑动以迭代布局形状
forEachShapeForEachShapeCallback将被调用的回调每个形状

例子

(Presentation pres = new Presentation("pres.pptx"))
{
    ForEach.Slide(pres, (slide, index) =>
    {
        ForEach.Shape(slide, (shape, baseSlide, shapeIndex) =>
        {
            System.Console.WriteLine($"{shape.Name}, index: {shapeIndex}");
        });
    });
} 

也可以看看