セクション
Contents
[
Hide
]
プレゼンテーションセクションの管理例 — 追加、アクセス、削除、名前変更を Aspose.Slides for PHP via Java を使用してプログラムで実行します。
セクションを追加
特定のスライドから開始するセクションを作成します。
function addSection() {
$presentation = new Presentation();
try {
$slide = $presentation->getSlides()->get_Item(0);
// セクションの開始を示すスライドを指定します。
$presentation->getSections()->addSection("New Section", $slide);
$presentation->save("section.pptx", SaveFormat::Pptx);
} finally {
$presentation->dispose();
}
}
セクションにアクセス
プレゼンテーションからセクション情報を読み取ります。
function accessSection() {
$presentation = new Presentation("section.pptx");
try {
// インデックスでセクションにアクセスします。
$section = $presentation->getSections()->get_Item(0);
$sectionName = $section->getName();
} finally {
$presentation->dispose();
}
}
セクションを削除
以前に追加したセクションを削除します。
function removeSection() {
$presentation = new Presentation("section.pptx");
try {
$section = $presentation->getSections()->get_Item(0);
// セクションを削除します。
$presentation->getSections()->removeSection($section);
$presentation->save("section_removed.pptx", SaveFormat::Pptx);
} finally {
$presentation->dispose();
}
}
セクションの名前を変更
既存のセクションの名前を変更します。
function renameSection() {
$presentation = new Presentation("section.pptx");
try {
$section = $presentation->getSections()->get_Item(0);
$section->setName("New Name");
$presentation->save("section_renamed.pptx", SaveFormat::Pptx);
} finally {
$presentation->dispose();
}
}