Sections

Presentation.Sections Eigenschaft

Gibt eine Liste aller Folienabschnitte zurück, die in der Präsentation definiert sind. Nur lesbar ISectionCollection.

public ISectionCollection Sections { get; }

Beispiele

Die folgenden Beispiele zeigen, wie man Abschnitte in einer PowerPoint-Präsentation erstellt.

[C#]
using (Presentation pres = new Presentation())
{
    ISlide defaultSlide = pres.Slides[0];
    ISlide newSlide1 = pres.Slides.AddEmptySlide(pres.LayoutSlides[0]);
    ISlide newSlide2 = pres.Slides.AddEmptySlide(pres.LayoutSlides[0]);
    ISlide newSlide3 = pres.Slides.AddEmptySlide(pres.LayoutSlides[0]);
    ISlide newSlide4 = pres.Slides.AddEmptySlide(pres.LayoutSlides[0]);
    ISection section1 = pres.Sections.AddSection("Abschnitt 1", newSlide1);
	// section1 wird bei newSlide2 beendet und danach beginnt section2
    ISection section2 = pres.Sections.AddSection("Abschnitt 2", newSlide3);
    pres.Save("pres-abschnitte.pptx", SaveFormat.Pptx);
    pres.Sections.ReorderSectionWithSlides(section2, 0);
    pres.Save("pres-abschnitte-verschoben.pptx", SaveFormat.Pptx);
    pres.Sections.RemoveSectionWithSlides(section2);
    pres.Sections.AppendEmptySection("Letzter leerer Abschnitt");
    pres.Save("pres-abschnitt-mit-leer.pptx",SaveFormat.Pptx);
}

Die folgenden Beispiele zeigen, wie man die Namen von Abschnitten ändert.

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
   ISection section = pres.Sections[0];
   section.Name = "Mein Abschnitt";
}

Siehe auch