頁眉與頁腳

展示如何使用 Aspose.Slides for Python via .NET 添加頁腳並更新日期與時間佔位符。

新增頁腳

在投影片的頁腳區域加入文字並使其可見。

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

        slide.header_footer_manager.set_footer_text("My footer")
        slide.header_footer_manager.set_footer_visibility(True)

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

Update Date and Time

更新日期與時間

修改投影片上的日期與時間佔位符。

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

        slide.header_footer_manager.set_date_time_text("01/01/2024")
        slide.header_footer_manager.set_date_time_visibility(True)

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