Back to Devexpress

DevExpress Presentation API Library: Create, Load, and Save Presentations

officefileapi-405410-presentation-api-create-load-presentations.md

latest4.3 KB
Original Source

DevExpress Presentation API Library: Create, Load, and Save Presentations

  • Nov 07, 2025
  • 2 minutes to read

The DevExpress Presentation API library allows you to create a new presentation or load an existing presentation from the following presentation formats:

  • PPTX
  • PPTM
  • POTX
  • POTM

Create a Presentation

Use the Presentation() parameterless constructor to create a new PPTX presentation with one empty slide (the slide’s layout type is SlideLayoutType.Title):

csharp
using DevExpress.Docs.Presentation;
//...
    Presentation presentation = new Presentation();
vb
Imports DevExpress.Docs.Presentation
'...
    Dim presentation As Presentation = New Presentation()

To specify the presentation format, use the Presentation constructor with the corresponding parameter (documentFormat).

A new presentation contains a single default slide master - a layout and appearance settings storage that helps you create consistent slides. For more information, refer to the following section: Layout Presets.

Load a Presentation from a Stream

Use the Presentation(Stream) constructor to load a presentation from a stream:

csharp
using DevExpress.Docs.Presentation;
//...
    using (FileStream fs = File.OpenRead(@"D:\mypresentation.pptx")) {
        Presentation presentation = new Presentation(fs);
        // Do something with the presentation. For example, export it:
        presentation.ExportToPdf(new FileStream(@"D:\exported-document.pdf", FileMode.Create));
    }
vb
Imports DevExpress.Docs.Presentation
'...
    Using fs As FileStream = File.OpenRead("D:\mypresentation.pptx")
        Dim presentation As Presentation = New Presentation(fs)
        ' Do something with the presentation. For example, export it:
        presentation.ExportToPdf(New FileStream("D:\exported-document.pdf", FileMode.Create))
    End Using

Note : If you try to load a corrupted presentation file or file in unsupported format, you get a PresentationUnsupportedFormatException.

Load a Presentation from a Byte Array

Use the Presentation(Byte[]) constructor to load a presentation from a byte array:

csharp
using DevExpress.Docs.Presentation;
//...
    Presentation presentation = new Presentation(File.ReadAllBytes(@"D:\mypresentation.pptx"));
vb
Imports DevExpress.Docs.Presentation
'...
    Dim presentation As Presentation = New Presentation(File.ReadAllBytes("D:\mypresentation.pptx"))

Note : If you try to load a corrupted presentation file or file in unsupported format, you get a PresentationUnsupportedFormatException.

Save the Presentation

Call the SaveDocument method to save the presentation to a file:

csharp
FileStream outputStream = new FileStream(@"D:\mypresentation.pptx", FileMode.Create);
presentation.SaveDocument(outputStream);
outputStream.Dispose();
vb
Dim outputStream As FileStream = New FileStream("D:\mypresentation.pptx", FileMode.Create)
presentation.SaveDocument(outputStream)
outputStream.Dispose()

To specify the presentation format when saving, use the SaveDocument overload with the corresponding parameter (documentFormat). The default format is PPTX.

Next Steps

Configure Slide Masters and LayoutsLearn how to configure slide masters and layouts.Manage SlidesLearn how to manage slides in a presentation.