ForEach

ForEach class

表示一组旨在遍历不同的 Presentation 模型对象的方法。这些方法在需要遍历和更改某些Presentation元素的格式或内容时非常有用,例如更改每个部分的格式。

public static class ForEach

Methods

NameDescription
static LayoutSlide(Presentation, ForEachLayoutSlideCallback)遍历 Presentation 中的每个 LayoutSlide
static MasterSlide(Presentation, ForEachMasterSlideCallback)遍历 Presentation 中的每个 MasterSlide
static Paragraph(Presentation, ForEachParagraphCallback)遍历 Presentation 中的每个 Paragraph。形状将在所有类型的幻灯片中遍历 - SlideMasterSlideLayoutSlide
static Paragraph(Presentation, bool, ForEachParagraphCallback)遍历 Presentation 中的每个 Paragraph。形状将在所有类型的幻灯片中遍历 - SlideMasterSlideLayoutSlideNotesSlide
static Portion(Presentation, ForEachPortionCallback)遍历 Presentation 中的每个 Portion。部分将在所有类型的幻灯片中遍历 - SlideMasterSlideLayoutSlide
static Portion(Presentation, bool, ForEachPortionCallback)遍历 Presentation 中的每个 Portion。部分将在所有类型的幻灯片中遍历 - SlideMasterSlideLayoutSlideNotesSlide
static Shape(BaseSlide, ForEachShapeCallback)遍历 BaseSlide 中的每个 ShapeBaseSlideSlideMasterSlideLayoutSlide 的基类型
static Shape(Presentation, ForEachShapeCallback)遍历 Presentation 中的每个 Shape。形状将在所有类型的幻灯片中遍历 - SlideMasterSlideLayoutSlide
static Shape(Presentation, bool, ForEachShapeCallback)遍历 Presentation 中的每个 Shape,如果需要,形状将在所有类型的幻灯片中遍历 - SlideMasterSlideLayoutSlideNotesSlide
static Slide(Presentation, ForEachSlideCallback)遍历 Presentation 中的每个 Slide

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