PowerPoint File Properties

GemBox.presentation supports two types of file properties: built-in and custom.

Built-in properties contain general information about the document, such as the title, authors, date, etc. Custom properties are those that users define, both name and value.

With the following example, you can learn how to read both built-in and custom presentation properties.

PowerPoint presentation properties read with GemBox.Presentation
Screenshot of PowerPoint presentation properties read with GemBox.Presentation
Upload your file (Drag file here)
using GemBox.Presentation;

class Program
{
    static void Main()
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        var presentation = PresentationDocument.Load("%InputFileName%");

        var slide = presentation.Slides[0];

        slide.Content.Drawings.Clear();

        // Create "Built-in document properties" text box.
        var textBox = slide.Content.AddTextBox(ShapeGeometryType.Rectangle, 0.5, 0.5, 12, 10, LengthUnit.Centimeter);
        textBox.Shape.Format.Outline.Fill.SetSolid(Color.FromName(ColorName.DarkBlue));

        var paragraph = textBox.AddParagraph();
        paragraph.Format.Alignment = HorizontalAlignment.Left;

        var run = paragraph.AddRun("Built-in document properties:");
        run.Format.Bold = true;

        paragraph.AddLineBreak();

        foreach (var docProp in presentation.DocumentProperties.BuiltIn)
        {
            paragraph.AddRun(string.Format("{0}: {1}", docProp.Key, docProp.Value));
            paragraph.AddLineBreak();
        }

        // Create "Custom document properties" text box.
        textBox = slide.Content.AddTextBox(ShapeGeometryType.Rectangle, 14, 0.5, 12, 10, LengthUnit.Centimeter);
        textBox.Shape.Format.Outline.Fill.SetSolid(Color.FromName(ColorName.DarkBlue));

        paragraph = textBox.AddParagraph();
        paragraph.Format.Alignment = HorizontalAlignment.Left;

        run = paragraph.AddRun("Custom document properties:");
        run.Format.Bold = true;

        paragraph.AddLineBreak();

        foreach (var docProp in presentation.DocumentProperties.Custom)
        {
            paragraph.AddRun(string.Format("{0}: {1} (Type: {2})", docProp.Key, docProp.Value, docProp.Value.GetType()));
            paragraph.AddLineBreak();
        }

        presentation.Save("Document Properties.%OutputFileType%");
    }
}
Imports GemBox.Presentation

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim presentation = PresentationDocument.Load("%InputFileName%")

        Dim slide = presentation.Slides(0)

        slide.Content.Drawings.Clear()

        ' Create "Built-in document properties" text box.
        Dim textBox = slide.Content.AddTextBox(ShapeGeometryType.Rectangle, 0.5, 0.5, 12, 10, LengthUnit.Centimeter)
        textBox.Shape.Format.Outline.Fill.SetSolid(Color.FromName(ColorName.DarkBlue))

        Dim paragraph = textBox.AddParagraph()
        paragraph.Format.Alignment = HorizontalAlignment.Left

        Dim run = paragraph.AddRun("Built-in document properties:")
        run.Format.Bold = True

        paragraph.AddLineBreak()

        For Each docProp In presentation.DocumentProperties.BuiltIn

            paragraph.AddRun(String.Format("{0}: {1}", docProp.Key, docProp.Value))
            paragraph.AddLineBreak()
        Next

        ' Create "Custom document properties" text box.
        textBox = slide.Content.AddTextBox(ShapeGeometryType.Rectangle, 14, 0.5, 12, 10, LengthUnit.Centimeter)
        textBox.Shape.Format.Outline.Fill.SetSolid(Color.FromName(ColorName.DarkBlue))

        paragraph = textBox.AddParagraph()
        paragraph.Format.Alignment = HorizontalAlignment.Left

        run = paragraph.AddRun("Custom document properties:")
        run.Format.Bold = True

        paragraph.AddLineBreak()

        For Each docProp In presentation.DocumentProperties.Custom

            paragraph.AddRun(String.Format("{0}: {1} (Type: {2})", docProp.Key, docProp.Value, docProp.Value.GetType()))
            paragraph.AddLineBreak()
        Next

        presentation.Save("Document Properties.%OutputFileType%")
    End Sub
End Module

See also


Next steps

GemBox.Presentation is a .NET component that enables you to read, write, edit, convert, and print presentation files from your .NET applications using one simple API.

Download Buy