PPT PPTX ODP POT ppsx
Aspose.Slides  for Python via .NET
POTM

使用 Python 編輯 POTM 屬性

構建您自己的 Python 應用程序,以使用服務器端 API 修改演示文稿文件中的內置和自定義屬性。

通過 Python 修改 POTM 屬性

使用 Aspose.Slides for Python via .NET,開發人員可以訪問和修改內置屬性以及自定義屬性的值。開發人員可以使用 Presentation 對象公開的 DocumentProperties 屬性來訪問演示文件的文檔屬性。

修改 POTM 內置屬性 - Python


import aspose.slides as slides

# Instantiate the Presentation class that represents the Presentation
with slides.Presentation(path + "ModifyBuiltinProperties.potm") as presentation:
    # Create a reference to object associated with Presentation
    documentProperties = presentation.document_properties

    # Set the builtin properties
    documentProperties.author = "Aspose.Slides for Python"
    documentProperties.title = "Modifying Presentation Properties"
    documentProperties.subject = "Aspose Subject"
    documentProperties.comments = "Aspose Description"
    documentProperties.manager = "Aspose Manager"

    # save your presentation to a file
    presentation.save("DocumentProperties_out.potm", slides.export.SaveFormat.POTM)

將自定義屬性添加到 POTM - Python


import aspose.slides as slides

# Instantiate the Presentation class
with slides.Presentation() as presentation:
    # Getting Document Properties
    documentProperties = presentation.document_properties

    # Adding Custom properties
    documentProperties.set_custom_property_value("New Custom", 12)
    documentProperties.set_custom_property_value("My Nam", "Aspose Metadata Editor")
    documentProperties.set_custom_property_value("Custom", 124)

    # Getting property name at particular index
    getPropertyName = documentProperties.get_custom_property_name(2)

    # Removing selected property
    documentProperties.remove_custom_property(getPropertyName)

    # Saving presentation
    presentation.save("CustomDocumentProperties_out.potm", slides.export.SaveFormat.POTM)

如何通過 Python 提取 POTM 的元數據

這些是從 POTM 文件中提取元數據的步驟。

  1. 使用 POTM 文件的路徑實例化 Presentation 類

  2. 獲取與 Presentation 關聯的 DocumentProperties 對象

  3. 遍歷 DocumentProperties 對像中的項目

  4. 訪問和修改自定義屬性

其他支持的元數據格式

使用 Python,您還可以操作許多其他格式的元數據,包括。