Sekce

Příklady správy sekcí prezentace—přidávat, přistupovat, odstraňovat a přejmenovávat je programově pomocí Aspose.Slides for .NET.

Přidat sekci

Vytvořte sekci, která začíná na konkrétním snímku.

static void AddSection()
{
    using var presentation = new Presentation();
    var slide = presentation.Slides[0];

    // Specifikujte snímek, který označuje začátek sekce.
    presentation.Sections.AddSection("New Section", slide);
}

Přístup k sekci

Přečtěte informace o sekci z prezentace.

static void AccessSection()
{
    using var presentation = new Presentation();
    var slide = presentation.Slides[0];

    presentation.Sections.AddSection("My Section", slide);

    // Přístup k sekci podle indexu.
    var section = presentation.Sections[0];
    var sectionName = section.Name;
}

Odstranit sekci

Odstraňte dříve přidanou sekci.

static void RemoveSection()
{
    using var presentation = new Presentation();
    var slide = presentation.Slides[0];

    var section = presentation.Sections.AddSection("Temporary Section", slide);

    // Odstraňte první sekci.
    presentation.Sections.RemoveSection(section);
}

Přejmenovat sekci

Změňte název existující sekce.

static void RenameSection()
{
    using var presentation = new Presentation();
    var slide = presentation.Slides[0];

    presentation.Sections.AddSection("Old Name", slide);

    var section = presentation.Sections[0];
    section.Name = "New Name";
}