بخش
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();
}
}