ForEach

ForEach class

Represents a group of methods intended to iterate over different 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

Methods

NameDescription
static LayoutSlide(Presentation, ForEachLayoutSlideCallback)Iterate each LayoutSlide in the Presentation.
static MasterSlide(Presentation, ForEachMasterSlideCallback)Iterate each MasterSlide in the Presentation.
static Paragraph(Presentation, ForEachParagraphCallback)Iterate each Paragraph in the Presentation. Shapes will be iterated in all type of slides - Slide, MasterSlide and LayoutSlide
static Paragraph(Presentation, bool, ForEachParagraphCallback)Iterate each Paragraph in the Presentation. Shapes will be iterated in all type of slides - Slide, MasterSlide, LayoutSlide and NotesSlide
static Portion(Presentation, ForEachPortionCallback)Iterate each Portion in the Presentation. Portions will be iterated in all type of slides - Slide, MasterSlide and LayoutSlide
static Portion(Presentation, bool, ForEachPortionCallback)Iterate each Portion in the Presentation. Portions will be iterated in all type of slides - Slide, MasterSlide, LayoutSlide and NotesSlide
static Shape(BaseSlide, ForEachShapeCallback)Iterate each Shape in the BaseSlide. BaseSlide is the base type for Slide, MasterSlide and LayoutSlide
static Shape(Presentation, ForEachShapeCallback)Iterate each Shape in the Presentation. Shapes will be iterated in all type of slides - Slide, MasterSlide and LayoutSlide
static 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.
static Slide(Presentation, ForEachSlideCallback)Iterate each Slide in the Presentation.

Other Members

NameDescription
delegate ForEachLayoutSlideCallback
delegate ForEachMasterSlideCallback
delegate ForEachParagraphCallback
delegate ForEachPortionCallback
delegate ForEachShapeCallback
delegate ForEachSlideCallback

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

See Also