# 使用 .NET 查看或編輯 PPT 文件元數據

> C# 源代碼，用於編輯或查看 PPT 格式元數據。

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



## 通過 C# 修改 PPT 屬性

使用 Aspose.Slides for .NET，開發人員可以訪問和修改內置屬性以及自定義屬性的值。開發人員可以使用 Presentation 對象公開的 [DocumentProperties](https://reference.aspose.com/slides/net/aspose.slides/documentproperties/) 屬性來訪問演示文件的文檔屬性。

### 修改 PPT 內置屬性 - C#

```cs

// Instantiate the Presentation class that represents the Presentation
Presentation presentation = new Presentation("presentation.ppt");

// Create a reference to IDocumentProperties object associated with Presentation
IDocumentProperties documentProperties = presentation.DocumentProperties;

// Set the builtin properties
documentProperties.Author = "Aspose.Slides for .NET";
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", SaveFormat.Ppt);
```

### 將自定義屬性添加到 PPT - C#

```cs

// Instantiate the Presentation class
Presentation presentation = new Presentation();

// Getting Document Properties
IDocumentProperties documentProperties = presentation.DocumentProperties;

// Adding Custom properties
documentProperties["New Custom"] = 12;
documentProperties["My Name"] = "Aspose Metadata Editor";
documentProperties["Custom"] = 124;

// Getting property name at particular index
String getPropertyName = documentProperties.GetCustomPropertyName(2);

// Removing selected property
documentProperties.RemoveCustomProperty(getPropertyName);

// Save your presentation to a file
presentation.Save("CustomDocumentProperties_out.ppt", SaveFormat.Ppt);
```

## 如何通過 C# 提取 PPT 的元數據

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

使用 PPT 文件的路徑實例化 Presentation 類

獲取與 Presentation 關聯的 DocumentProperties 對象

遍歷 DocumentProperties 對像中的項目

訪問和修改自定義屬性

## 其他支持的元數據格式
