Sections

Presentation.Sections свойство

Возвращает список всех секций слайдов, которые определены в презентации. Только для чтения ISectionCollection.

public ISectionCollection Sections { get; }

Примеры

Следующие примеры показывают, как создать секции в 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 будет завершен на newSlide2, и после него начнется section2
    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("Последняя пустая секция");
    pres.Save("pres-section-with-empty.pptx",SaveFormat.Pptx);
}

Следующие примеры показывают, как изменить названия секций.

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
   ISection section = pres.Sections[0];
   section.Name = "Моя секция";
}

См. также