Sectie

Voorbeelden voor het beheren van presentatiesecties—voeg toe, benader, verwijder en hernoem ze programmatisch met Aspose.Slides for Python via .NET.

Sectie toevoegen

Maak een sectie aan die begint bij een specifieke dia.

def add_section():
    with slides.Presentation() as presentation:
        slide = presentation.slides[0]

        # Voeg een nieuwe sectie toe en geef de dia op die het begin van de sectie aangeeft.
        presentation.sections.add_section("New Section", slide)

        presentation.save("section.pptx", slides.export.SaveFormat.PPTX)

Sectie benaderen

Haalt een sectie op uit een presentatie.

def access_section():
    with slides.Presentation("section.pptx") as presentation:

        # Toegang tot een sectie via index.
        section = presentation.sections[0]

Sectie verwijderen

Verwijder een eerder toegevoegde sectie.

def remove_section():
    with slides.Presentation("section.pptx") as presentation:
        section = presentation.sections[0]

        # Verwijder de sectie.
        presentation.sections.remove_section(section)

        presentation.save("section_removed.pptx", slides.export.SaveFormat.PPTX)

Sectie hernoemen

Wijzig de naam van een bestaande sectie.

def rename_section():
    with slides.Presentation("section.pptx") as presentation:
        section = presentation.sections[0]

        # Hernoem de sectie.
        section.name = "New Name"

        presentation.save("section_renamed.pptx", slides.export.SaveFormat.PPTX)