Create MS PowerPoint Presentations in C#

MS PowerPoint presentations allow you to create slide shows containing text, images, charts, animations, and other elements. Various additional formatting options let you make your presentations more appealing. In this post, you will come to know how to create PowerPoint PPT PPTX in C# . You will learn how to insert text, tables, images, and charts in PowerPoint PPT in programmatically in C# .

  • C# PowerPoint API
  • Create a PowerPoint Presentation
  • Open an Existing PowerPoint Presentation
  • Add Slide to a Presentation
  • Add Text to Presentation’s Slide
  • Create a Table in Presentation
  • Create a Chart in Presentation
  • Add an Image in Presentation

C# API to Create PowerPoint PPT - Free Download #

Aspose.Slides for .NET is a presentation manipulation API that lets you create and manipulate PowerPoint documents from within your .NET applications. The API provides nearly all possible features required to implement basic as well as advanced PowerPoint automation features. You can either download the API or install it via NuGet .

Create a PowerPoint PPT in C# #

Let’s start by creating an empty PowerPoint PPT/PPTX presentation using Aspose.Slides for .NET. The following are the steps to do so.

The following code sample shows how to create a PowerPoint presentation in C#.

Open an Existing PowerPoint Presentation in C# #

You don’t need to put extra efforts in order to open an existing PowerPoint presentation. Simply provide the path of the PPTX file to the constructor of the Presentation class and you are done. The following code sample shows how to open an existing PPTX presentation.

Add a Slide to PPT in C# #

Once you have created the presentation, you can start adding the slides to it. The following are the steps to add a slide in the presentation using Aspose.Slides for .NET.

The following code sample shows how to add a slide in a PowerPoint presentation using C#.

Insert Text in a PPT Slide using C# #

Now we can add content to the slides in the PowerPoint presentation. Let’s first add a piece of text to the slide using the following steps.

The following code sample shows how to add text to slide in a presentation using C#.

Create Table in a PPT Presentation using C# #

Aspose.Slides for .NET provides an easy way to create a table in the presentation document. The following are the steps for it.

The following code sample shows how to create table in a slide of PowerPoint presentation.

Create Chart in a PowerPoint PPT using C# #

The following are the steps to add a chart in PowerPoint presentation using C#.

The following code sample shows how to add chart in a presentation using C#.

Learn more about the presentation charts here .

Add an Image in PowerPoint Presentation #

The following are the steps to add images in the presentation slide.

The following code sample shows how to add image to a presentation in C#.

C# .NET PowerPoint API - Get a Free License #

You can use Aspose.Slides for .NET without evaluation limitations by getting a free temporary license .

Conclusion #

In this article, you have learned how to create PowerPoint PPT presentations from scratch using C#. In addition, you have seen how to add slides, text, tables, images, and charts in new or existing PPTX presentations. You can learn more about the API using the documentation .

Tip: Besides the creation of slides or presentations, Aspose.Slides provides many features that allow you to work with presentations. For example, using its own APIs, Aspose developed a free online viewer for Microsoft PowerPoint Presentations .

Facebook Pixel Code

BoldSign Easily embed eSignatures in your .NET applications. Free sandbox with native SDK available.

Breadcrumb seperator

How to create a PowerPoint presentation file in C#, VB.NET

2X faster development

Help us improve!

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

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Create a presentation document by providing a file name (Open XML SDK)

This topic shows how to use the classes in the Open XML SDK 2.5 to create a presentation document programmatically.

To use the sample code in this topic, you must install the Open XML SDK 2.5 . You must explicitly reference the following assemblies in your project:

WindowsBase

DocumentFormat.OpenXml (Installed by the Open XML SDK)

You must also use the following using directives or Imports statements to compile the code in this topic.

Create a Presentation

A presentation file, like all files defined by the Open XML standard, consists of a package file container. This is the file that users see in their file explorer; it usually has a .pptx extension. The package file is represented in the Open XML SDK 2.5 by the PresentationDocument class. The presentation document contains, among other parts, a presentation part. The presentation part, represented in the Open XML SDK 2.5 by the PresentationPart class, contains the basic PresentationML definition for the slide presentation. PresentationML is the markup language used for creating presentations. Each package can contain only one presentation part, and its root element must be <presentation>.

The API calls used to create a new presentation document package are relatively simple. The first step is to call the static Create(String,PresentationDocumentType) method of the PresentationDocument class, as shown here in the CreatePresentation procedure, which is the first part of the complete code sample presented later in the article. The CreatePresentation code calls the override of the Create method that takes as arguments the path to the new document and the type of presentation document to be created. The types of presentation documents available in that argument are defined by a PresentationDocumentType enumerated value.

Next, the code calls AddPresentationPart() , which creates and returns a PresentationPart . After the PresentationPart class instance is created, a new root element for the presentation is added by setting the Presentation property equal to the instance of the Presentation class returned from a call to the Presentation class constructor.

In order to create a complete, useable, and valid presentation, the code must also add a number of other parts to the presentation package. In the example code, this is taken care of by a call to a utility function named CreatePresentationsParts . That function then calls a number of other utility functions that, taken together, create all the presentation parts needed for a basic presentation, including slide, slide layout, slide master, and theme parts.

Using the Open XML SDK 2.5, you can create presentation structure and content by using strongly-typed classes that correspond to PresentationML elements. You can find these classes in the DocumentFormat.OpenXml.Presentation namespace. The following table lists the names of the classes that correspond to the presentation, slide, slide master, slide layout, and theme elements. The class that corresponds to the theme element is actually part of the DocumentFormat.OpenXml.Drawing namespace. Themes are common to all Open XML markup languages.

The PresentationML code that follows is the XML in the presentation part (in the file presentation.xml) for a simple presentation that contains two slides.

Sample Code

Following is the complete sample C# and VB code to create a presentation, given a file path.

About the Open XML SDK 2.5 for Office

Structure of a PresentationML Document

How to: Insert a new slide into a presentation (Open XML SDK)

How to: Delete a slide from a presentation (Open XML SDK)

How to: Retrieve the number of slides in a presentation document (Open XML SDK)

How to: Apply a theme to a presentation (Open XML SDK)

Additional resources

Instantly share code, notes, and snippets.

@aspose-com-gists

aspose-com-gists / add-image.cs

FPPT

Create PowerPoint .PPT programmatically using C#

If you are a developed and want to create your PPT presentations using C# or VB, then you can use the Office Interop libraries to code your own PPT and .pptx files programmatically. This article will show you a quick snippet to make PowerPoint files on the fly.

Create PowerPoint .PPT programmatically using C#

First, you need to prepare your environment and associate the Interop libraries. You can download Interop libraries for free, but you will need to have Office installed. This was tested on Office 2010 but it should work in 2007 as well.

Now, we will explain what this snippet does.

First, we obtain the Presentation object from the Interop library, which will help us to access PowerPoint and other Microsoft Office programs. Of course to make this work you will need to have Office installed and the Interop libraries referenced in the application.

Then, we will create a Custom Layout using the pptLayoutText that has the presentation title and content. It is the default layout that we can find when we open PowerPoint.

Now we get the slides array and add a new slide object. This will be inserted as the slide #1.

Next, we get the title shape and write the presentation title.

We will do the same with the presentation content. Notice that here we are inserting a bullet list (separated by \n) using C#. This can be helpful to insert a list of items, but if you don’t want to insert a bullet list you can just insert the plain text.

Then, will add a simple comment into the speaker notes to demonstrate that it is also possible to insert notes.

And finally we will need to save the presentation as an output file, unless you want to keep it opened in your window. Notice that to choose if the window should be opened or not, it is defined in the

example add slide csharp powerpoint interop

Here is the source code snippet from Snippet.io

Share this post:

One comment on “ create powerpoint .ppt programmatically using c# ”.

Comments are closed.

We will send you our curated collections to your email weekly. No spam, promise!

create presentation using c#

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Create PowerPoint presention on the fly using C# [closed]

I have tried looking into the creation of a PowerPoint presentation using C# but i was not able to find how i would clone slides from a template and add charts to a presentation slide on the fly using C#.

After the presentation has been created save the file as well.

Using Aspose.slide for .NET

Furqan Safdar's user avatar

You can also refer to the following useful links:

Cloning Slides including Images and Charts in PowerPoint presentations & Using Open XML SDK 2.0 Productivity Tool

Add Chart on the fly to PowerPoint

Create PowerPoint .PPT programmatically using C#

How to create a PowerPoint presentation using C# and embed a Picture to the slide

Not the answer you're looking for? Browse other questions tagged c# powerpoint or ask your own question .

Hot Network Questions

create presentation using c#

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

Create and write PowerPoint files in C# and VB.NET

The following example shows how you can create a new PowerPoint file and write some shape and text to the presentation.

Open and read PowerPoint files from C# / VB.NET applications

Load and Save PPTX from C# / VB.NET applications

GemBox.Presentation is a .NET component that enables you to read, write, edit, convert, and print presentation files from your .NET applications using one simple API.

C# SDK to View, Process & Convert Slides in Cloud

C# cloud sdk to help you create & process powerpoint & openoffice presentations in the cloud, without installing any software., aspose.slides cloud sdk for .net, download from nuget.

Open NuGet package manager, search for and install. You may also use the following command from the Package Manager Console.

Aspose.Slides Cloud SDK for .NET is used to seamlessly integrate PPT, PPTX, ODP, OTP processing capabilities into your cloud-based applications built using C#, ASP.NET or other .NET supported languages. Aspose.Slides Cloud SDK for .NET is a wrapper around Aspose.Slides REST API and is offered under an MIT license.

Aspose.Slides Cloud SDK for .NET enhances your C# code to create PowerPoint presentations, merge selected slides, split presentations, as well as convert PowerPoint & OpenOffice presentation documents to PDF, XPS, JPEG, PNG, BMP, TIFF, SVG, HTML & SWF.

Aspose.Slides Cloud SDK for .NET also allows your cloud-based .NET application to work with presentation slide animations, read and clone master slide information, extract & download slide notes, extract presentation image to a particular format, extract shapes from a slide, as well as perform various other operations using your C# programs via our Aspose.Slides Cloud SDK for .NET.

At a Glance

Platform independence, supported file formats.

.NET PowerPoint Cloud SDK

Aspose.Slides Cloud supported file formats.

.NET Cloud SDK for Presentations

Aspose.Slides Cloud supports all major platforms and programming languages.

Platform Independence

Advanced PowerPoint manipulation Features

Get presentation images in specified format

Add, update, remove, convert slide notes

Copy layout slide or master slide from source presentation

Merge multiple presentations specified in request parameter

Fetch information about slide placeholders

Set, fetch or remove presentation document properties

Create, update or convert slide to supported formats

Extract and replace text from specific slide or entire presentation

Fetch slide color or font theme information

Create presentation and export it to supported formats

Create presentation document from HTML

Split presentation into multiple ones

Get Started with PowerPoint Presentation Processing

It is easy to get started with Aspose.Slides Cloud SDK for .NET as you need nothing to install. Simply create an account at Aspose for Cloud and get your application information. Once you have the App SID & key, you are ready to give the Aspose.Slides Cloud SDK for .NET a try on any platform.

Presentation Slide Processing Features

Aspose.Slides Cloud SDK for .NET allows the developers to perform basic to advanced presentation slide processing operations. You can read presentation slides information. Create new slides. Copy, modify or delete existing slides. Convert presentation slides from PowerPoint formats to other supported formats via Cloud SDK. You can also manipulate slide background by apply new background, read and remove existing background for any slide. Aspose.Slides Cloud SDK for .NET enables you to reorder slide position within the presentation. You can also copy a slide from current or another presentation. Presentation slide comments can also be retrieved.

Processing Slide Shapes and Notes

Aspose.Slides Cloud SDK for .NET allows developers to create new shapes for presentation slides. You can read and update properties information for existing slide shapes. Our presentation slides processing Cloud SDK enables you to render slides shapes to supported image formats. Aspose.Slides Cloud SDK for .NET also helps you work with presentation slide notes.

Aspose.Slides for

Aspose.Slides Cloud for cURL

Aspose.Slides for

Aspose.Slides Cloud for .NET

Aspose.Slides for

Aspose.Slides Cloud for Java

Aspose.Slides for

Aspose.Slides Cloud for PHP

Aspose.Slides for

Aspose.Slides Cloud for Android

Aspose.Slides for

Aspose.Slides Cloud for Python

Aspose.Slides for

Aspose.Slides Cloud for Ruby

Aspose.Slides for

Aspose.Slides Cloud for Node.js

Aspose.Slides for

Aspose.Slides Cloud for C++

Aspose.Slides for

Aspose.Slides Cloud for Perl

Aspose.Slides for

Aspose.Slides Cloud for Swift

Aspose.Slides for

Aspose.Slides Cloud for Go

IMAGES

  1. C# Tutorial Ppt Slides

    create presentation using c#

  2. Create Presentation using PowerPoint

    create presentation using c#

  3. Create User Login System using C# Examples » Pakainfo

    create presentation using c#

  4. Visual Studio 2019 (WPF C# Source Code & XAML) How to Create a Simple Hello World Program in C#

    create presentation using c#

  5. How to create a PowerPoint presentation using C# and embed a Picture to the slide

    create presentation using c#

  6. C#

    create presentation using c#

VIDEO

  1. Using Dictation in PowerPoint

  2. Template functions in C++

  3. C# Lecture 3

  4. C++ Review: Class Templates

  5. C# Group Project Outline

  6. YouTube / Brandcast

COMMENTS

  1. Signs and Symptoms of Hepatitis C

    Hepatitis C, a virus that attacks the liver, is a tricky disease. Some people have it and may never know it as they are affected by any sorts of symptoms. It can remain silent until there is severe damage to your liver.

  2. Everything You Need to Know About Vitamin C

    Whether in the form of a fizzy drink or flavored lozenges, cold and flu preventative supplements almost always highlight vitamin C as one of their key ingredients. So, what’s so magical about vitamin C? Also known as ascorbic acid, vitamin ...

  3. What Are the Five C’s of Communication?

    Hansen Communication Lab developed the concept of the five C’s of communication, which are the following: articulate clearly; speak correctly; be considerate; give compliments; and have confidence.

  4. Create PowerPoint PPT in C#

    Create Chart in a PowerPoint PPT using C## · Create an instance of the Presentation class. · Obtain the reference of a slide by index. · Add a

  5. How to create a PowerPoint file in C#

    //Create a PowerPoint presentation instance · presentation = Presentation ; //Add a blank slide to the PowerPoint instance · slide = presentation.Slides.Add(

  6. How to create a PowerPoint presentation file in C#, VB.NET

    Steps to create PowerPoint programmatically: · 'Create a new PowerPoint presentation · Dim powerpointDoc As IPresentation = Presentation.Create() · 'Add a blank

  7. How to create PPT using C#

    How to create Power Point Presentation using ASP NET C# I have explained the following:How to Create PPTHow to Add Slide in PPTHow to Update

  8. Create a presentation document by providing a file name (Open

    You must also use the following using directives or Imports statements to compile the code in this topic. C# Copy. using DocumentFormat.OpenXml;

  9. Create PowerPoint Presentations in C# · GitHub

    add-image.cs · Create presentation · var ; add-slide.cs · Instantiate Presentation class that represents the presentation file · Presentation ; create-presentation.cs

  10. Create PowerPoint .PPT programmatically using C#

    PowerPoint.TextRange objText; // Create the Presentation File Presentation pptPresentation = pptApplication.Presentations.Add(MsoTriState.msoTrue); Microsoft.

  11. Create PowerPoint presention on the fly using C#

    1 Answer 1 · Cloning Slides including Images and Charts in PowerPoint presentations & Using Open XML SDK 2.0 Productivity Tool · Add Chart on the

  12. Create and write PowerPoint files in C# and VB.NET

    You can save the presentation using one of the PresentationDocument.Save methods from your C# and VB.NET application. These methods enable you to work with

  13. VSTO: Using C# to Create PowerPoint Presentations: A Practical

    VSTO: Using C# to Create PowerPoint Presentations: A Practical Guide to Automating PowerPoint Presentation Creation Using Visual Studio Tools for Office.

  14. Build Presentation Creator & Viewer with C# REST SDK

    C# Cloud SDK to help you create & process PowerPoint & OpenOffice presentations in the cloud, without installing any software.