Shape

Shape(Presentation, ForEachShapeCallback)

Iterate each Shape in the Presentation. Shapes will be iterated in all type of slides - Slide, MasterSlide and LayoutSlide

public static void Shape(Presentation pres, ForEachShapeCallback forEachShape)
ParameterTypeDescription
presPresentationPresentation to iterate layout shapes
forEachShapeForEachShapeCallbackCallback that will be invoked for each shape

Examples

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

See Also


Shape(Presentation, bool, ForEachShapeCallback)

Iterate each Shape in the Presentation. Shapes will be iterated in all type of slides - Slide, MasterSlide, LayoutSlide and NotesSlide if needed.

public static void Shape(Presentation pres, bool includeNotes, ForEachShapeCallback forEachShape)
ParameterTypeDescription
presPresentationPresentation to iterate layout shapes
includeNotesBooleanFlag that indicates whether NotesSlides should be included in processing.
forEachShapeForEachShapeCallbackCallback that will be invoked for each shape

Examples

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

See Also


Shape(BaseSlide, ForEachShapeCallback)

Iterate each Shape in the BaseSlide. BaseSlide is the base type for Slide, MasterSlide and LayoutSlide

public static void Shape(BaseSlide baseSlide, ForEachShapeCallback forEachShape)
ParameterTypeDescription
baseSlideBaseSlideSlide to iterate layout shapes
forEachShapeForEachShapeCallbackCallback that will be invoked for each shape

Examples

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

See Also