# 使用 Python 查看或编辑 PPT 文件元数据

> Python 源代码，用于编辑或查看 PPT 格式元数据。

Source: https://products.aspose.com/slides/zh/python-net/metadata/ppt/
Updated: 2023-04-25



## 通过 Python 修改 PPT 属性

使用 Aspose.Slides for Python via .NET，开发人员可以访问和修改内置属性以及自定义属性的值。开发人员可以使用 Presentation 对象公开的 [DocumentProperties](https://reference.aspose.com/slides/python-net/aspose.slides/documentproperties/) 属性来访问演示文件的文档属性。

### 修改 PPT 内置属性 - Python

```py

import aspose.slides as slides

# Instantiate the Presentation class that represents the Presentation
with slides.Presentation(path + "ModifyBuiltinProperties.ppt") 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.ppt", slides.export.SaveFormat.PPT)
```

### 将自定义属性添加到 PPT - Python

```py

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.ppt", slides.export.SaveFormat.PPT)
```

## 如何通过 Python 提取 PPT 的元数据

这些是从 PPT 文件中提取元数据的步骤。

使用 PPT 文件的路径实例化 Presentation 类

获取与 Presentation 关联的 DocumentProperties 对象

遍历 DocumentProperties 对象中的项目

访问和修改自定义属性

## 其他支持的元数据格式
