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 ForEachLayoutSlideCallbackCallback that will be invoked for each LayoutSlide in the Presentation.
delegate ForEachMasterSlideCallbackCallback that will be invoked for each MasterSlide in the Presentation.
delegate ForEachParagraphCallbackCallback that will be invoked for each Paragraph on the BaseSlide.
delegate ForEachPortionCallbackCallback that will be invoked for each Portion in the Paragraph on the BaseSlide.
delegate ForEachShapeCallbackCallback that will be invoked for each Shape in the Presentation.
delegate ForEachSlideCallbackCallback that will be invoked for each Slide in the Presentation.

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