Abschnitte

Presentation.Sections-Eigenschaft

Gibt eine Liste aller Folienabschnitte zurück, die in der Präsentation definiert sind. Nur-Lese 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 enden und danach wird section2 beginnen
    ISection section2 = pres.Sections.AddSection("Abschnitt 2", newSlide3);
    pres.Save("pres-sections.pptx", SaveFormat.Pptx);
    pres.Sections.ReorderSectionWithSlides(section2, 0);
    pres.Save("pres-sections-moved.pptx", SaveFormat.Pptx);
    pres.Sections.RemoveSectionWithSlides(section2);
    pres.Sections.AppendEmptySection("Letzter leerer Abschnitt");
    pres.Save("pres-section-with-empty.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