PPT PPTX ODP POT ppsx
Aspose.Slides  for .NET
OTP

使用 C# 编辑 OTP 属性

构建您自己的 .NET 应用程序,以使用服务器端 API 修改演示文稿文件中的内置和自定义属性。

通过 C# 修改 OTP 属性

使用 Aspose.Slides for .NET,开发人员可以访问和修改内置属性以及自定义属性的值。开发人员可以使用 Presentation 对象公开的 DocumentProperties 属性来访问演示文件的文档属性。

修改 OTP 内置属性 - C#


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

// 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.otp", SaveFormat.Otp);

将自定义属性添加到 OTP - C#


// 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.otp", SaveFormat.Otp);

如何通过 C# 提取 OTP 的元数据

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

  1. 使用 OTP 文件的路径实例化 Presentation 类

  2. 获取与 Presentation 关联的 DocumentProperties 对象

  3. 遍历 DocumentProperties 对象中的项目

  4. 访问和修改自定义属性

其他支持的元数据格式

使用 C#,您还可以操作许多其他格式的元数据,包括。