How to create a PowerPoint presentation file in Windows Forms
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 used to create, open, read, edit, and convert PowerPoint presentations. Using this library, you can start creating a PowerPoint document in Windows Forms.
Steps to create PowerPoint programmatically in Windows Forms:
- Create a new Windows Forms application.
- Install Syncfusion.Presentation.Base NuGet package to the console application project from . For more information about adding a NuGet feed in Visual Studio and installing NuGet packages, refer to
- Include the following namespace in the Form1.cs file.
- 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(10, 10, 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(50, 50, 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()
By executing the program, you will get the PowerPoint document as follows.
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 to learn about generating and registering Syncfusion license key in your application to use the components without trail message.