PPT
PPTX
ODP
POT
ppsx
PPTX
使用 Python 編輯 PPTX 屬性
構建您自己的 Python 應用程序,以使用服務器端 API 修改演示文稿文件中的內置和自定義屬性。
通過 Python 修改 PPTX 屬性
使用 Aspose.Slides for Python via .NET,開發人員可以訪問和修改內置屬性以及自定義屬性的值。開發人員可以使用 Presentation 對象公開的 DocumentProperties 屬性來訪問演示文件的文檔屬性。
修改 PPTX 內置屬性 - Python
import aspose.slides as slides
# Instantiate the Presentation class that represents the Presentation
with slides.Presentation(path + "ModifyBuiltinProperties.pptx") 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.pptx", slides.export.SaveFormat.PPTX)
將自定義屬性添加到 PPTX - 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.pptx", slides.export.SaveFormat.PPTX)
如何通過 Python 提取 PPTX 的元數據
這些是從 PPTX 文件中提取元數據的步驟。
使用 PPTX 文件的路徑實例化 Presentation 類
獲取與 Presentation 關聯的 DocumentProperties 對象
遍歷 DocumentProperties 對像中的項目
訪問和修改自定義屬性