Back to Devexpress

Presentation.DocumentProperties Property

officefileapi-devexpress-dot-docs-dot-presentation-dot-presentation-14939e87.md

latest4.9 KB
Original Source

Presentation.DocumentProperties Property

Obtains presentation document properties.

Namespace : DevExpress.Docs.Presentation

Assembly : DevExpress.Docs.Presentation.v25.2.dll

NuGet Package : DevExpress.Docs.Presentation

Declaration

csharp
public DocumentProperties DocumentProperties { get; }
vb
Public ReadOnly Property DocumentProperties As DocumentProperties

Property Value

TypeDescription
DocumentProperties

Document properties associated with the presentation.

|

Remarks

DocumentProperties obtains all document properties. You have the option to select between built-in and custom document properties.

Built-In Document Properties

The following code snippet specifies built-in document properties:

csharp
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));
}
vb
Imports DevExpress.Docs.Presentation
'...
Using presentation = New Presentation(File.ReadAllBytes("C:\Documents\Presentation.pptx"))
  Dim 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))
End Using

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:

csharp
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));
}
vb
Imports DevExpress.Docs.Presentation

Using presentation = New Presentation(File.ReadAllBytes("C:\Documents\Presentation.pptx"))
  Dim customProperties = presentation.DocumentProperties.CustomProperties
  customProperties.Add("string property", "string")
  customProperties.Add("boolean property", True)
  customProperties.Add("date property", Date.Now)
  customProperties.Add("int property", 5)
  customProperties.Add("double property", 2.55)

  presentation.SaveDocument(New FileStream("C:\Documents\Presentation_upd.pptx", FileMode.Create))
End Using

See Also

Obtain and Change Presentation Document Properties with the DevExpress Presentation API Library

Presentation Class

Presentation Members

DevExpress.Docs.Presentation Namespace