Obtain and Change Presentation Document Properties with the DevExpress Presentation API Library
- 2 minutes to read
Document properties are metadata stored in a presentation. The DevExpress Presentation API library allows you to obtain or specify this metadata.
The Presentation.DocumentProperties property obtains all document properties. You can specify built-in and custom document properties.
Important
The DevExpress Presentation API Library is currently available as a Community Technology Preview (CTP). Note that we do not recommend that you integrate pre-release libraries into mission-critical software applications. You can try the library and share your feedback so that we can make necessary adjustments before the official release. To start a conversation, submit a ticket via the DevExpress Support Center — we’d love to hear from you.
Obtain or Specify Built-In Document Properties
The DocumentProperties class contains built-in properties. The table below lists available properties:
Property | Updates Automatically | Read Only |
---|---|---|
Application | No | No |
Author | No | No |
Category | No | No |
Company | No | No |
ContentStatus | No | No |
Created | Yes | No |
Description | No | No |
DocumentRevision | No | No |
DocumentVersion | No | No |
HiddenSlides | No | Yes |
Keywords | No | No |
LastModifiedBy | Yes | No |
Modified | Yes | No |
Notes | No | Yes |
PresentationFormat | No | Yes |
Printed | Yes | No |
Security | No | Yes |
Slides | No | Yes |
Subject | No | No |
Title | No | No |
Version | No | No |
The following code snippet specifies document properties:
using DevExpress.Docs.Presentation;
//...
using (var presentation = new Presentation(File.ReadAllBytes("C:\\Documents\\Presentation.pptx")))
{
var documentProperties = presentation.DocumentProperties;
documentProperties.Author = "Jane Doe";
documentProperties.Title = " Innovating for the Future: Trends in Sustainable Technology";
documentProperties.Company = "GreenTech Solutions Inc.";
documentProperties.Keywords = "Sustainability, Green Technology, Innovation, Future Trends, Eco-Friendly Solutions";
presentation.SaveDocument(new FileStream("C:\\Documents\\Presentation_upd.pptx", FileMode.Create));
}
Obtain or Specify Custom Document Properties
The DocumentProperties.CustomProperties property allows you to specify custom document properties. Call the Add method to add a new custom property:
The following code snippet creates new custom properties:
using DevExpress.Docs.Presentation;
using (var presentation = new Presentation(File.ReadAllBytes("C:\\Documents\\Presentation.pptx")))
{
var customProperties = presentation.DocumentProperties.CustomProperties;
customProperties.Add("string property", "string");
customProperties.Add("boolean property", true);
customProperties.Add("date property", DateTime.Now);
customProperties.Add("int property", 5);
customProperties.Add("double property", 2.55);
presentation.SaveDocument(new FileStream("C:\\Documents\\Presentation_upd.pptx", FileMode.Create));
}