)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create a PowerPoint presentation in ASP.NET MVC

Platform: ASP.NET MVC |
Control: Presentation |
Published Date: November 20, 2017 |
Last Revised Date: February 5, 2020

Syncfusion Essential PowerPoint is a .NET PowerPoint library used to create, read, and edit PowerPoint documents. Using this library, you can start creating a PowerPoint document in ASP.NET MVC.

Steps to create a PowerPoint file programmatically:

  1. Create a new ASP.NET MVC application project. Create new ASP.NET application in visual studio
  2. Select the MVC template to create the project. Create MVC Project
  3. Install the Syncfusion.Presentation.ASPNet.MVC5 NuGet package as reference to your .NET Framework application from NuGet.org. Install NuGets
  4. A default controller with name HomeController.cs gets added on creation of ASP.NET MVC project. Include the following namespace in that HomeController.cs file.

C#:

using Syncfusion.Presentation;

VB:

Imports Syncfusion.Presentation
  1. A default action method named Index will be present in HomeController.cs. Right click on this action method and select Go To View where you will be directed to its associated view page Index.cshtml.
  2. Add a new button in the Index.cshtml as shown below.
    @{Html.BeginForm("CreateDocument", "Home", FormMethod.Get);
        {
            <div>
                <input type="submit" value="Create Document" style="width:150px;height:27px" />
            </div>
        }
        Html.EndForm();
    }
    
  1. Add a new action method CreateDocument in HomeController.cs and include the below code snippet to create a PowerPoint file and download it.

C#:

//Creates a PowerPoint instance
IPresentation pptxDoc = Presentation.Create();
 
//Adds a slide to the PowerPoint presentation
ISlide slide = pptxDoc.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
pptxDoc.Save("Sample.pptx", FormatType.Pptx, HttpContext.ApplicationInstance.Response);
 
//Close the PowerPoint presentation
pptxDoc.Close();

VB:

'Creates a PowerPoint instance
Dim pptxDoc As IPresentation = Presentation.Create()
 
'Adds a slide to the PowerPoint presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
 
'Add a textbox to the slide.
Dim shape As IShape = slide.AddTextBox(10, 10, 500, 100)
 
'Add a text to the textbox.
shape.TextBody.AddParagraph("Hello World!!!")
 
'Save the PowerPoint Presentation
pptxDoc.Save("Sample.pptx", FormatType.Pptx, HttpContext.ApplicationInstance.Response)
 
'Close the PowerPoint presentation
pptxDoc.Close()

A complete working example of how to create a PowerPoint file in ASP.NET MVC can be downloaded from Create PowerPoint file.zip

By executing the program, you will get the PowerPoint file as follows. Presentation Output file

Take a moment to peruse the documentation, where you will find other options like create and edit PowerPoint tables, create and edit PowerPoint charts, convert PowerPoint slides to images, and convert PowerPoint file to PDF with code examples.

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

An online sample link to generate PowerPoint file.

See Also:

Create a PowerPoint file in Windows Forms

Create a PowerPoint file in WPF

Create a PowerPoint file in Xamarin

Create a PowerPoint file in UWP

Create a PowerPoint file in ASP.Net Core

Create a PowerPoint file in Azure Function

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.

 

2X faster development

The ultimate ASP.NET MVC UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon