PPT
PPTX
ODP
POT
ppsx
POTX
使用 Python 编辑 POTX 属性
构建您自己的 Python 应用程序,以使用服务器端 API 修改演示文稿文件中的内置和自定义属性。
通过 Python 修改 POTX 属性
使用 Aspose.Slides for Python via .NET,开发人员可以访问和修改内置属性以及自定义属性的值。开发人员可以使用 Presentation 对象公开的 DocumentProperties 属性来访问演示文件的文档属性。
修改 POTX 内置属性 - Python
import aspose.slides as slides
# Instantiate the Presentation class that represents the Presentation
with slides.Presentation(path + "ModifyBuiltinProperties.potx") 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.potx", slides.export.SaveFormat.POTX)
将自定义属性添加到 POTX - 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.potx", slides.export.SaveFormat.POTX)
如何通过 Python 提取 POTX 的元数据
这些是从 POTX 文件中提取元数据的步骤。
使用 POTX 文件的路径实例化 Presentation 类
获取与 Presentation 关联的 DocumentProperties 对象
遍历 DocumentProperties 对象中的项目
访问和修改自定义属性