Skip to main content
All docs
V25.1
  • DocumentCustomPropertyDictionary Class

    Contains custom document properties of a presentation.

    Namespace: DevExpress.Docs.Presentation

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

    NuGet Package: DevExpress.Docs.Presentation

    Declaration

    public class DocumentCustomPropertyDictionary :
        PresentationDictionary<string, DocumentCustomProperty>

    The following members return DocumentCustomPropertyDictionary objects:

    Remarks

    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));
    }
    

    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));
    }
    

    Inheritance

    See Also