Sections

Propriété Presentation.Sections

Renvoie une liste de toutes les sections de diapositives définies dans la présentation. En lecture seule ISectionCollection.

public ISectionCollection Sections { get; }

Exemples

Les exemples suivants montrent comment créer des Sections dans une présentation PowerPoint.

[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("Section 1", newSlide1);
	// section1 se terminera à newSlide2 et après, section2 commencera
    ISection section2 = pres.Sections.AddSection("Section 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("Dernière section vide");
    pres.Save("pres-section-with-empty.pptx", SaveFormat.Pptx);
}

Les exemples suivants montrent comment changer les noms des Sections.

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

Voir Aussi