Class ForEach

Class ForEach

Namespace: Aspose.Slides.LowCode
Assembly: Aspose.Slides.dll (25.12.0)

Represents a group of methods intended to iterate over different Aspose.Slides.Presentation model objects. These methods can be useful if you need to iterate and change some Presentation’ elements formatting or content, e.g. change each portion formatting.

public static class ForEach

Inheritance

object ForEach

Examples

using (Presentation presentation = new Presentation("pres.pptx"))
{
   ForEach.Portion(presentation, (portion, para, slide, index) =>
   {
       portion.PortionFormat.LatinFont = new FontData("Times New Roman");
   });

   presentation.Save("pres-out.pptx", SaveFormat.Pptx);
}

Methods

LayoutSlide(Presentation, ForEachLayoutSlideCallback)

Iterate each Aspose.Slides.LowCode.ForEach.LayoutSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachLayoutSlideCallback) in the Aspose.Slides.Presentation.

public static void LayoutSlide(Presentation pres, ForEach.ForEachLayoutSlideCallback forEachLayoutSlide)

Parameters

pres Presentation

Presentation to iterate layout slides

forEachLayoutSlide ForEach . ForEachLayoutSlideCallback

Callback that will be invoked for each layout slide

Examples

using (Presentation pres = new Presentation("pres.pptx"))
{
    ForEach.LayoutSlide(pres, (layoutSlide, index) =>
    {
        layoutSlide.Name = $"LayoutSlide #{index}";
    });
}

MasterSlide(Presentation, ForEachMasterSlideCallback)

Iterate each Aspose.Slides.LowCode.ForEach.MasterSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachMasterSlideCallback) in the Aspose.Slides.Presentation.

public static void MasterSlide(Presentation pres, ForEach.ForEachMasterSlideCallback forEachMasterSlide)

Parameters

pres Presentation

Presentation to iterate master slides

forEachMasterSlide ForEach . ForEachMasterSlideCallback

Callback that will be invoked for each master slide

Examples

using (Presentation pres = new Presentation("pres.pptx"))
{
    ForEach.MasterSlide(pres, (slide, index) =>
    {
        slide.Name = $"MasterSlide #{index}";
    });
}

Paragraph(Presentation, ForEachParagraphCallback)

Iterate each Aspose.Slides.LowCode.ForEach.Paragraph(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachParagraphCallback) in the Aspose.Slides.Presentation. Shapes will be iterated in all type of slides - Aspose.Slides.LowCode.ForEach.Slide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachSlideCallback), Aspose.Slides.LowCode.ForEach.MasterSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachMasterSlideCallback) and Aspose.Slides.LowCode.ForEach.LayoutSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachLayoutSlideCallback)

public static void Paragraph(Presentation pres, ForEach.ForEachParagraphCallback forEachParagraph)

Parameters

pres Presentation

Presentation to iterate paragraphs

forEachParagraph ForEach . ForEachParagraphCallback

Callback that will be invoked for each paragraph

Examples

using (Presentation pres = new Presentation("pres.pptx"))
{
    ForEach.Paragraph(pres, (para, slide, index) =>
    {
        System.Console.WriteLine($"{para.Text}, index: {index}");
    });
}

Paragraph(Presentation, bool, ForEachParagraphCallback)

Iterate each Aspose.Slides.LowCode.ForEach.Paragraph(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachParagraphCallback) in the Aspose.Slides.Presentation. Shapes will be iterated in all type of slides - Aspose.Slides.LowCode.ForEach.Slide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachSlideCallback), Aspose.Slides.LowCode.ForEach.MasterSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachMasterSlideCallback), Aspose.Slides.LowCode.ForEach.LayoutSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachLayoutSlideCallback) and Aspose.Slides.NotesSlide

public static void Paragraph(Presentation pres, bool includeNotes, ForEach.ForEachParagraphCallback forEachParagraph)

Parameters

pres Presentation

Presentation to iterate paragraphs

includeNotes bool

Flag that indicates whether NotesSlides should be included in processing.

forEachParagraph ForEach . ForEachParagraphCallback

Callback that will be invoked for each paragraph

Examples

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

Portion(Presentation, ForEachPortionCallback)

Iterate each Aspose.Slides.LowCode.ForEach.Portion(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachPortionCallback) in the Aspose.Slides.Presentation. Portions will be iterated in all type of slides - Aspose.Slides.LowCode.ForEach.Slide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachSlideCallback), Aspose.Slides.LowCode.ForEach.MasterSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachMasterSlideCallback) and Aspose.Slides.LowCode.ForEach.LayoutSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachLayoutSlideCallback)

public static void Portion(Presentation pres, ForEach.ForEachPortionCallback forEachPortion)

Parameters

pres Presentation

Presentation to iterate portions

forEachPortion ForEach . ForEachPortionCallback

Callback that will be invoked for each portion

Examples

using (Presentation pres = new Presentation("pres.pptx"))
{
    ForEach.Portion(pres, (portion, para, slide, index) =>
    {
        System.Console.WriteLine($"{portion.Text}, index: {index}");
    });
}

Portion(Presentation, bool, ForEachPortionCallback)

Iterate each Aspose.Slides.LowCode.ForEach.Portion(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachPortionCallback) in the Aspose.Slides.Presentation. Portions will be iterated in all type of slides - Aspose.Slides.LowCode.ForEach.Slide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachSlideCallback), Aspose.Slides.LowCode.ForEach.MasterSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachMasterSlideCallback), Aspose.Slides.LowCode.ForEach.LayoutSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachLayoutSlideCallback) and Aspose.Slides.NotesSlide

public static void Portion(Presentation pres, bool includeNotes, ForEach.ForEachPortionCallback forEachPortion)

Parameters

pres Presentation

Presentation to iterate portions

includeNotes bool

Flag that indicates whether NotesSlides should be included in processing.

forEachPortion ForEach . ForEachPortionCallback

Callback that will be invoked for each portion

Examples

using (Presentation pres = new Presentation("pres.pptx"))
{
    ForEach.Portion(pres, true, (portion, para, slide, index) =>
    {
        System.Console.WriteLine($"{portion.Text}, index: {index}");
    });
}

Shape(Presentation, ForEachShapeCallback)

Iterate each Aspose.Slides.LowCode.ForEach.Shape(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachShapeCallback) in the Aspose.Slides.Presentation. Shapes will be iterated in all type of slides - Aspose.Slides.LowCode.ForEach.Slide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachSlideCallback), Aspose.Slides.LowCode.ForEach.MasterSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachMasterSlideCallback) and Aspose.Slides.LowCode.ForEach.LayoutSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachLayoutSlideCallback)

public static void Shape(Presentation pres, ForEach.ForEachShapeCallback forEachShape)

Parameters

pres Presentation

Presentation to iterate layout shapes

forEachShape ForEach . ForEachShapeCallback

Callback 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}");
    });
}

Shape(Presentation, bool, ForEachShapeCallback)

Iterate each Aspose.Slides.LowCode.ForEach.Shape(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachShapeCallback) in the Aspose.Slides.Presentation. Shapes will be iterated in all type of slides - Aspose.Slides.LowCode.ForEach.Slide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachSlideCallback), Aspose.Slides.LowCode.ForEach.MasterSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachMasterSlideCallback), Aspose.Slides.LowCode.ForEach.LayoutSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachLayoutSlideCallback) and Aspose.Slides.NotesSlide if needed.

public static void Shape(Presentation pres, bool includeNotes, ForEach.ForEachShapeCallback forEachShape)

Parameters

pres Presentation

Presentation to iterate layout shapes

includeNotes bool

Flag that indicates whether NotesSlides should be included in processing.

forEachShape ForEach . ForEachShapeCallback

Callback 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}");
    });
}

Shape(BaseSlide, ForEachShapeCallback)

Iterate each Aspose.Slides.LowCode.ForEach.Shape(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachShapeCallback) in the Aspose.Slides.BaseSlide. Aspose.Slides.BaseSlide is the base type for Aspose.Slides.LowCode.ForEach.Slide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachSlideCallback), Aspose.Slides.LowCode.ForEach.MasterSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachMasterSlideCallback) and Aspose.Slides.LowCode.ForEach.LayoutSlide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachLayoutSlideCallback)

public static void Shape(BaseSlide baseSlide, ForEach.ForEachShapeCallback forEachShape)

Parameters

baseSlide BaseSlide

Slide to iterate layout shapes

forEachShape ForEach . ForEachShapeCallback

Callback 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}");
        });
    });
}

Slide(Presentation, ForEachSlideCallback)

Iterate each Aspose.Slides.LowCode.ForEach.Slide(Aspose.Slides.Presentation,Aspose.Slides.LowCode.ForEach.ForEachSlideCallback) in the Aspose.Slides.Presentation.

public static void Slide(Presentation pres, ForEach.ForEachSlideCallback forEachSlide)

Parameters

pres Presentation

Presentation to iterate slides

forEachSlide ForEach . ForEachSlideCallback

Callback that will be invoked for each slide

Examples

using (Presentation pres = new Presentation("pres.pptx"))
{
    ForEach.Slide(pres, (slide, index) =>
    {
        slide.Name = $"Slide #{index}";
    });
}