Skip to main content
All docs
V25.1
  • DevExpress Presentation API Library: Create, Load, and Save Presentations

    • 2 minutes to read

    Important

    The DevExpress Presentation API Library is currently available as a Community Technology Preview (CTP). Note that we do not recommend that you integrate pre-release libraries into mission-critical software applications. You can try the library and share your feedback so that we can make necessary adjustments before the official release. To start a conversation, submit a ticket via the DevExpress Support Center — we’d love to hear from you.

    The DevExpress Presentation API library allows you to create a new presentation or load an existing presentation from a PPTX file.

    Create a Presentation

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

    using DevExpress.Docs.Presentation;
    //...
        Presentation presentation = new Presentation();
    

    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:

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

    Note: If you try to load a corrupted PPTX file or file in another 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:

    using DevExpress.Docs.Presentation;
    //...
        Presentation presentation = new Presentation(File.ReadAllBytes(@"D:\mypresentation.pptx"));
    

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

    Save the Presentation

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

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

    Next Steps

    Configure Slide Masters and Layouts
    Learn how to configure slide masters and layouts.
    Manage Slides
    Learn how to manage slides in a presentation.