Examine Presentation

Aspose.Slides for .NET allows you to examine a presentation to find out its properties and understand its behavior.

Check a Presentation Format

Before working on a presentation, you may want to find out what format (PPT, PPTX, ODP, and others) the presentation is in at the moment.

You can check a presentation’s format without loading the presentation. See this C# code:

IPresentationInfo info = PresentationFactory.Instance.GetPresentationInfo("pres.pptx");
Console.WriteLine(info.LoadFormat); // PPTX

IPresentationInfo info2 = PresentationFactory.Instance.GetPresentationInfo("pres.ppt");
Console.WriteLine(info2.LoadFormat); // PPT

IPresentationInfo info3 = PresentationFactory.Instance.GetPresentationInfo("pres.odp");
Console.WriteLine(info3.LoadFormat); // ODP

Get Presentation Properties

This C# code shows you how to get presentation properties (information about the presentation):

IPresentationInfo info = PresentationFactory.Instance.GetPresentationInfo("pres.pptx");
IDocumentProperties props = info.ReadDocumentProperties();
Console.WriteLine(props.CreatedTime);
Console.WriteLine(props.Subject);
Console.WriteLine(props.Title);
// .. 

You may want to see the properties under the DocumentProperties class.

Update Presentation Properties

Aspose.Slides provides the PresentationInfo.UpdateDocumentProperties method that allows you to make changes to presentation properties.

Let’s say we have a PowerPoint presentation with the document properties shown below.

Original document properties of the PowerPoint presentation

This code example shows you how to edit some presentation properties:

string fileName = "sample.pptx";

IPresentationInfo info = PresentationFactory.Instance.GetPresentationInfo(fileName);

IDocumentProperties properties = info.ReadDocumentProperties();
properties.Title = "My title";
properties.LastSavedTime = DateTime.Now;

info.UpdateDocumentProperties(properties);
info.WriteBindedPresentation(fileName);

The results of changing the document properties are shown below.

Changed document properties of the PowerPoint presentation

To get more information about a presentation and its security attributes, you may find these links useful: