بخش

مثال‌هایی برای مدیریت بخش‌های ارائه—اضافه کردن، دسترسی، حذف و تغییر نام آن‌ها به صورت برنامه‌نویسی با استفاده از Aspose.Slides for Python via .NET.

افزودن یک بخش

یک بخش ایجاد کنید که از یک اسلاید خاص آغاز می‌شود.

def add_section():
    with slides.Presentation() as presentation:
        slide = presentation.slides[0]

        # یک بخش جدید اضافه کنید و اسلایدی را که شروع بخش را مشخص می‌کند، تعیین کنید.
        presentation.sections.add_section("New Section", slide)

        presentation.save("section.pptx", slides.export.SaveFormat.PPTX)

دسترسی به یک بخش

یک بخش را از یک ارائه دریافت کنید.

def access_section():
    with slides.Presentation("section.pptx") as presentation:

        # دسترسی به یک بخش بر اساس اندیس.
        section = presentation.sections[0]

حذف یک بخش

بخشی که قبلاً اضافه شده است را حذف کنید.

def remove_section():
    with slides.Presentation("section.pptx") as presentation:
        section = presentation.sections[0]

        # حذف بخش.
        presentation.sections.remove_section(section)

        presentation.save("section_removed.pptx", slides.export.SaveFormat.PPTX)

تغییر نام یک بخش

نام یک بخش موجود را تغییر دهید.

def rename_section():
    with slides.Presentation("section.pptx") as presentation:
        section = presentation.sections[0]

        # تغییر نام بخش.
        section.name = "New Name"

        presentation.save("section_renamed.pptx", slides.export.SaveFormat.PPTX)