officefileapi-devexpress-dot-docs-dot-presentation-b124681d.md
Contains custom document properties of a presentation.
Namespace : DevExpress.Docs.Presentation
Assembly : DevExpress.Docs.Presentation.v25.2.dll
NuGet Package : DevExpress.Docs.Presentation
public class DocumentCustomPropertyDictionary :
PresentationDictionary<string, DocumentCustomProperty>
Public Class DocumentCustomPropertyDictionary
Inherits PresentationDictionary(Of String, DocumentCustomProperty)
The following members return DocumentCustomPropertyDictionary objects:
The DocumentCustomPropertyDictionary class allows you to add custom metadata (or document properties) to the presentation file. Call the Add method to add a new custom property. The following property types are available:
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));
}
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
You can also use the Item[TKey] property to add a new custom property. Set a value to the property with the name specified in square brackets. If a property with this name does not exist, it is created automatically. Otherwise, an exception occurs.
using DevExpress.Docs.Presentation;
using (var presentation = new Presentation(File.ReadAllBytes("C:\\Documents\\Presentation.pptx"))) {
var customProperties = presentation.DocumentProperties.CustomProperties;
customProperties["string property"] ="string";
customProperties["boolean property"] = true;
customProperties["date property"] = DateTime.Now;
customProperties["int property"] = 5;
customProperties["double property"] = 2.55;
presentation.SaveDocument(new FileStream("C:\\Documents\\Presentation_upd.pptx", FileMode.Create));
}
Imports DevExpress.Docs.Presentation
Using presentation = New Presentation(File.ReadAllBytes("C:\Documents\Presentation.pptx"))
Dim customProperties = presentation.DocumentProperties.CustomProperties
customProperties("string property") ="string"
customProperties("boolean property") = True
customProperties("date property") = Date.Now
customProperties("int property") = 5
customProperties("double property") = 2.55
presentation.SaveDocument(New FileStream("C:\Documents\Presentation_upd.pptx", FileMode.Create))
End Using
IDictionary<String, DocumentCustomProperty>
ICollection<KeyValuePair<String, DocumentCustomProperty>>
IEnumerable<KeyValuePair<String, DocumentCustomProperty>>
Object PresentationDictionary<String, DocumentCustomProperty> DocumentCustomPropertyDictionary
See Also