セクション

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

セクションの追加

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

static void addSection() {
    Presentation presentation = new Presentation();
    try {
        ISlide slide = presentation.getSlides().get_Item(0);

        // セクションの開始を示すスライドを指定します。
        presentation.getSections().addSection("New Section", slide);
    } finally {
        presentation.dispose();
    }
}

セクションへのアクセス

プレゼンテーションからセクション情報を取得します。

static void accessSection() {
    Presentation presentation = new Presentation();
    try {
        ISlide slide = presentation.getSlides().get_Item(0);

        presentation.getSections().addSection("My Section", slide);

        // インデックスでセクションにアクセスします。
        ISection section = presentation.getSections().get_Item(0);
        String sectionName = section.getName();
    } finally {
        presentation.dispose();
    }
}

セクションの削除

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

static void removeSection() {
    Presentation presentation = new Presentation();
    try {
        ISlide slide = presentation.getSlides().get_Item(0);

        ISection section = presentation.getSections().addSection("Temporary Section", slide);

        // 最初のセクションを削除します。
        presentation.getSections().removeSection(section);
    } finally {
        presentation.dispose();
    }
}

セクションの名前変更

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

static void renameSection() {
    Presentation presentation = new Presentation();
    try {
        ISlide slide = presentation.getSlides().get_Item(0);

        presentation.getSections().addSection("Old Name", slide);

        ISection section = presentation.getSections().get_Item(0);
        section.setName("New Name");
    } finally {
        presentation.dispose();
    }
}