Skip to content

Repository files navigation

DevExpress Presentation API Library – Get Started

This example creates a new presentation, adds three slides, and populates slides with content.

Slide #1

slide 1

Slide #2

slide 2

Slide #3

slide 3

Important

You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use our Office File API library in production code. For pricing information, refer to the following webpage: DevExpress Subscriptions.

Implementation Details

  • Use the Presentation() parameterless constructor to create a new presentation.

    Presentationpresentation=newPresentation();
  • A newly created presentation contains a single default slide master. The Slide Master is a top-level template slide that you can use as a base for other slides. Slide masters store content, layouts and settings that you can share among derived slides. The default slide master goes first in the Presentation.SlideMasters collection.

    SlideMasterslideMaster=presentation.SlideMasters[0];
  • To create a slide, initialize a Slide object and add it to the Presentation.Slides collection. For each slide, specify the layout type as a constructor parameter. In this example, slides use predefined layouts stored in the slide master. To obtain a layout from SlideMaster.Layouts, call the Get or GetOrCreate method.

    Slideslide1=newSlide(slideMaster.Layouts.Get(SlideLayoutType.Title));//...presentation.Slides.Add(slide1);
  • Layouts add placeholder shapes to slides. Use the Slide.Shapes collection to access placeholder shapes and populate them with content.

    foreach(Shapeshapeinslide1.Shapes){if(shape.PlaceholderSettings.TypeisPlaceholderType.CenteredTitle){shape.TextArea=newTextArea("Daily Testing Status Report");}if(shape.PlaceholderSettings.TypeisPlaceholderType.Subtitle){shape.TextArea=newTextArea($"{DateTime.Now: dddd, MMMM d, yyyy}");}}
  • You can save the resulting presentation to a PPTX file and export it to a PDF file:

    FileStreamoutputStream=newFileStream(@"..\..\..\data\my-presentation.pptx",FileMode.Create);presentation.SaveDocument(outputStream);outputStream.Dispose();presentation.ExportToPdf(newFileStream(@"..\..\..\data\exported-document.pdf",FileMode.Create));

Files to Review

Documentation

More Examples

Does This Example Address Your Development Requirements/Objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Creates a presentation with slides and saves it to PPTX and PDF.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages