PowerPoint File Properties

Presentation can contain built-in and custom properties.

Following example shows how to read built-in and custom presentation properties.

Screenshot
PowerPoint Library for C# / VB.NET Screenshot

See the full code below, use Run Example to execute.

Upload your file(Drag files here)

Download an input file

using System;
using System.IO;
using System.Linq;
using GemBox.Presentation;
using GemBox.Presentation.Media;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        PresentationDocument presentation = PresentationDocument.Load("Reading.pptx");

        Slide slide = presentation.Slides[0];

        slide.Content.Drawings.Clear();

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

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

        TextRun 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.pptx");
    }
}
Imports System.IO
Imports GemBox.Presentation
Imports GemBox.Presentation.Media

Module Samples

    Sub Main()

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

        Dim presentation As PresentationDocument = PresentationDocument.Load("Reading.pptx")

        Dim slide As Slide = presentation.Slides(0)

        slide.Content.Drawings.Clear()

        ' Create "Built-in document properties" text box.
        Dim textBox As 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 As TextParagraph = textBox.AddParagraph()
        paragraph.Format.Alignment = HorizontalAlignment.Left

        Dim run As TextRun = 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.pptx")

    End Sub

End Module