Bagian
Contents
[
Hide
]
Contoh mengelola bagian presentasi—menambah, mengakses, menghapus, dan mengganti nama secara programatis menggunakan Aspose.Slides for PHP via Java.
Tambah Bagian
Buat bagian yang dimulai pada slide tertentu.
function addSection() {
$presentation = new Presentation();
try {
$slide = $presentation->getSlides()->get_Item(0);
// Tentukan slide yang menandai awal bagian.
$presentation->getSections()->addSection("New Section", $slide);
$presentation->save("section.pptx", SaveFormat::Pptx);
} finally {
$presentation->dispose();
}
}
Akses Bagian
Baca informasi bagian dari presentasi.
function accessSection() {
$presentation = new Presentation("section.pptx");
try {
// Akses bagian dengan indeks.
$section = $presentation->getSections()->get_Item(0);
$sectionName = $section->getName();
} finally {
$presentation->dispose();
}
}
Hapus Bagian
Hapus bagian yang sebelumnya ditambahkan.
function removeSection() {
$presentation = new Presentation("section.pptx");
try {
$section = $presentation->getSections()->get_Item(0);
// Hapus bagian.
$presentation->getSections()->removeSection($section);
$presentation->save("section_removed.pptx", SaveFormat::Pptx);
} finally {
$presentation->dispose();
}
}
Ganti Nama Bagian
Ubah nama bagian yang ada.
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();
}
}