Articles in this section
Category / Section

How to create a PowerPoint presentation file in WPF

2 mins read

PowerPoint presentation is a file format that allows you to create and show a series of slides containing text, shapes, charts, images and SmartArt diagrams with rich set of formatting options to make your presentation more attractive and memorable. Syncfusion Essential Presentation is a .NET PowerPoint library used to create, open, read, edit, and convert PowerPoint presentations. Using this library, you can start creating a PowerPoint document in WPF.

Steps to create a PowerPoint presentation file in WPF:

  1. Create a new WPF application.

  1. Install Syncfusion.Presentation.Base NuGet package to the console application project from nuget.org. For more information about adding a NuGet feed in Visual Studio and installing NuGet packages, refer to documentation.

 

  1. Include the following namespace in the MainWindow.xaml.cs file.
using Syncfusion.Presentation;

 

Imports Syncfusion.Presentation

 

  1. Use the following code snippet to create PowerPoint presentation with “Hello World” text.
//Create a new PowerPoint presentation
IPresentation powerpointDoc = Presentation.Create();
 
//Add a blank slide to the presentation
ISlide slide = powerpointDoc.Slides.Add(SlideLayoutType.Blank);
 
//Add a textbox to the slide
IShape shape = slide.AddTextBox(400, 100, 500, 100);
 
//Add a text to the textbox.
shape.TextBody.AddParagraph("Hello World!!!");
 
//Save the PowerPoint presentation
powerpointDoc.Save("Sample.pptx");
 
//Close the PowerPoint presentation
powerpointDoc.Close();

 

'Create a new PowerPoint presentation
Dim powerpointDoc As IPresentation = Presentation.Create()
 
'Add a blank slide to the presentation
Dim slide As ISlide = powerpointDoc.Slides.Add(SlideLayoutType.Blank)
 
'Add a textbox to the slide
Dim shape As IShape = slide.AddTextBox(400, 100, 500, 100)
 
'Add a text to the textbox.
shape.TextBody.AddParagraph("Hello World!!!")
 
'Save the PowerPoint presentation
powerpointDoc.Save("Sample.pptx")
 
'Close the PowerPoint presentation
powerpointDoc.Close()

 

You can download the working sample from Create-PowerPoint.Zip.

By executing the program, you will get the PowerPoint document as follows.

 

Take a moment to peruse the documentation, where you can find other options to format the text with code examples.

Refer here to explore the rich set of Syncfusion Essential Presentation features.

An online sample link to add text to a slide Hello world PowerPoint document

 

See Also:

Create a PowerPoint file in ASP.NET MVC

Create a PowerPoint file in ASP.NET

Create a PowerPoint file in Windows Forms

Create a PowerPoint file in Xamarin

Create a PowerPoint file in UWP

Note:

Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied