Bagian
Contents
[
Hide
]
Contoh mengelola bagian presentasi—menambah, mengakses, menghapus, dan mengganti nama secara programatis menggunakan Aspose.Slides for Python via .NET.
Tambah Bagian
Buat bagian yang dimulai pada slide tertentu.
def add_section():
with slides.Presentation() as presentation:
slide = presentation.slides[0]
# Tambahkan bagian baru dan tentukan slide yang menandai awal bagian tersebut.
presentation.sections.add_section("New Section", slide)
presentation.save("section.pptx", slides.export.SaveFormat.PPTX)
Akses Bagian
Dapatkan bagian dari sebuah presentasi.
def access_section():
with slides.Presentation("section.pptx") as presentation:
# Akses sebuah bagian berdasarkan indeks.
section = presentation.sections[0]
Hapus Bagian
Hapus bagian yang sebelumnya ditambahkan.
def remove_section():
with slides.Presentation("section.pptx") as presentation:
section = presentation.sections[0]
# Hapus bagian tersebut.
presentation.sections.remove_section(section)
presentation.save("section_removed.pptx", slides.export.SaveFormat.PPTX)
Ganti Nama Bagian
Ubah nama bagian yang ada.
def rename_section():
with slides.Presentation("section.pptx") as presentation:
section = presentation.sections[0]
# Ganti nama bagian.
section.name = "New Name"
presentation.save("section_renamed.pptx", slides.export.SaveFormat.PPTX)