Szakasz

Példák a prezentációszakaszok kezelésére – hozzáadás, elérés, eltávolítás és átnevezés programozott módon a Aspose.Slides for .NET használatával.

Szakasz hozzáadása

Hozzon létre egy szakaszt, amely egy adott dián kezdődik.

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

    // Specifikálja azt a diát, amely a szakasz kezdetét jelöli.
    presentation.Sections.AddSection("New Section", slide);
}

Szakasz elérése

Olvassa el a szakaszinformációkat egy prezentációból.

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

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

    // Hozzáférés egy szakaszhoz index alapján.
    var section = presentation.Sections[0];
    var sectionName = section.Name;
}

Szakasz eltávolítása

Töröljön egy korábban hozzáadott szakaszt.

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

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

    // Az első szakasz eltávolítása.
    presentation.Sections.RemoveSection(section);
}

Szakasz átnevezése

Változtassa meg egy meglévő szakasz nevét.

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";
}