セクション

Aspose.Slides for .NET を使用して、プレゼンテーションのセクションをプログラムで管理する例です。セクションの追加、アクセス、削除、名前変更が可能です。

セクションの追加

特定のスライドから開始するセクションを作成します。

static void Add_Section()
{
    using var pres = new Presentation();

    // セクションの開始を示すスライドを指定します
    pres.Sections.AddSection("New Section", pres.Slides[0]);
}

セクションへのアクセス

プレゼンテーションからセクション情報を読み取ります。

static void Access_Section()
{
    using var pres = new Presentation();
    pres.Sections.AddSection("My Section", pres.Slides[0]);

    // インデックスでセクションにアクセス
    var section = pres.Sections[0];
    var sectionName = section.Name;
}

セクションの削除

以前に追加したセクションを削除します。

static void Remove_Section()
{
    using var pres = new Presentation();
    var section = pres.Sections.AddSection("Temporary Section", pres.Slides[0]);

    // 最初のセクションを削除
    pres.Sections.RemoveSection(section);
}

セクションの名前変更

既存のセクションの名前を変更します。

static void Rename_Section()
{
    using var pres = new Presentation();
    pres.Sections.AddSection("Old Name", pres.Slides[0]);

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