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.
- Create an instance of the Presentation class.
- Save it as PPTX using Presentation.Save(String, SaveFormat) method.
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.
- Instantiate ISlideCollection class by setting a reference to the Presentations.Slides property.
- Add an empty slide to the presentation using Slide.AddEmptySlide(ILayoutSlide) method exposed by ISlideCollection object
- Save the presentation file using the Presentation.Save(String, SaveFormat) method.
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.
- Create a new presentation using the Presentation class.
- Obtain the reference of the slide in the presentation.
- Add an IAutoShape with ShapeType as Rectangle at a specified position of the slide.
- Obtain the reference of that newly added IAutoShape object.
- Add a TextFrame to the AutoShape containing the default text.
- Save the presentation as a PPTX file.
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.
- Obtain the reference of a slide by using its index.
- Define arrays of columns with width and rows with height.
- Add a table to the slide using Slide.Shapes.AddTable() method exposed by IShapes object and get the reference to the table in ITable instance.
- Iterate through each cell to apply the formatting.
- Add text to the cells using Table.Rows[][].TextFrame.Text property.
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#.
- Obtain the reference of a slide by index.
- Add a chart with the desired type using ISlide.Shapes.AddChart(ChartType, Single, Single, Single, Single) method.
- Add a chart title.
- Access the chart data worksheet.
- Clear all the default series and categories.
- Add new series and categories.
- Add new chart data for chart series.
- Set fill color for chart series.
- Add chart series labels.
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.
- Create a new presentation using Presentation class.
- Read SVG image using File.ReadAllText(String path) method.
- Add image to slide using Presentation.Slides[0].Shapes.AddPictureFrame(ShapeType shapeType, float x, float y,float width, float height, IPPImage image) method.
- Save the presentation.
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 .
- Protect PowerPoint PPTX Presentations using C#
- Create MS PowerPoint Presentations in ASP.NET
- Convert PowerPoint PPTX/PPT to PNG Images in C#
- Set Slide Background in PowerPoint Presentations using C#
- Generate Thumbnails for PowerPoint PPTX or PPT using C#
- Apply Animation to Text in PowerPoint using C#
- Split PowerPoint Presentations using C#
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 .
BoldSign Easily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
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 .

- Developer Platform
- Analytics Platform
- Reporting Platform
- eSignature Software and API
- Help Desk Software
- Knowledge Base Software
- Knowledge Base
- White Papers
- Case Studies
- Technical FAQ
- Code Examples
- Documentation
- Community Forum
- Contact Support
- Features & Bugs
- Tutorial Videos
- News & Events
- Fax: +1 919.573.0306
- US: +1 919.481.1974
- UK: +44 20 7084 6215
- Toll Free (USA): 1-888-9DOTNET
- [email protected]

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)
- 17 minutes to read
- 10 contributors
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)
- Open XML SDK 2.5 class library reference
Additional resources
Instantly share code, notes, and snippets.
aspose-com-gists / add-image.cs

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.

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

Here is the source code snippet from Snippet.io
Share this post:
One comment on “ create powerpoint .ppt programmatically using c# ”.
- Pingback: Create PowerPoint .PPT programmatically using C# | PowerPoint Presentation | PowerPoint presentations and PPT templates | Scoop.it
Comments are closed.
We will send you our curated collections to your email weekly. No spam, promise!
- Stack Overflow Public questions & answers
- Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
- Talent Build your employer brand
- Advertising Reach developers & technologists worldwide
- About the company
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
- Just for curiosity, why do you want to create PowerPoint presentation in C#? There are many 3rd party software, but can you tell why do you need to create PowerPoints through C#? – IMK Sep 21, 2018 at 6:11
- try www.pptxbuilder.com – Boosted_d16 Nov 7, 2018 at 18:01
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
- this is using open xml right... hiow about if i was to use aspose.slide – user1722654 Oct 8, 2012 at 10:30
- two of the links are dead! – chikitin Nov 15, 2020 at 19:35

Not the answer you're looking for? Browse other questions tagged c# powerpoint or ask your own question .
- The Overflow Blog
- How Intuit democratizes AI development across teams through reusability sponsored post
- The nature of simulating nature: A Q&A with IBM Quantum researcher Dr. Jamie...
- Featured on Meta
- We've added a "Necessary cookies only" option to the cookie consent popup
- Launching the CI/CD and R Collectives and community editing features for...
- The [amazon] tag is being burninated
- Temporary policy: ChatGPT is banned
- Staging Ground Beta 1 Recap, and Reviewers needed for Beta 2
Hot Network Questions
- Lagrange Points in General Relativity
- Is there any room for negotiation on my PhD program stipend offers?
- Why can't fire heat something hotter than itself, but electromagnetic waves can heat something indefinitely?
- Are there tables of wastage rates for different fruit and veg?
- Can carbocations exist in a nonpolar solvent?
- Heap implementation in C
- Are demand and time deposit accounts really loans _to_ the bank?
- Rolling cube on an infinite chessboard
- What is the difference between paper presentation and poster presentation?
- Align vertically 2 circuits
- Google maps for Space exploration
- Why do academics stay as adjuncts for years rather than move around?
- Is this summary of MCMC correct?
- How can I measure the power in mW of a radio signal?
- Does single case chance actually exist?
- Covering of a knot complement
- Non-trivial semisubgroups of the unit interval?
- I need to identify this connector from inside a hot tub control panel
- My contour integrations seem to contradict the residue theorem.
- Why are all monasteries human?
- Will DL360 Gen 8 servers fit in rails designed for DL360 Gen 7 servers?
- Resistance depending on voltage - the chicken and the egg?
- Is it natural that different quantities with the same physical dimension are distinguished by adverbs?
- What is the point of Thrower's Bandolier?
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.
- Aspose.Slides
- .NET
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.
- Get presentation images
- Work with slide notes
- Merge presentations
- Set presentation properties
- Convert slide format
- Extract and replace text
- Split presentations
- Create presentation from HTML

Aspose.Slides Cloud supported file formats.
- Microsoft PowerPoint: PPT, PPTX, PPS, PPSX, PPTM, PPSM, POTX, POTM
- OpenOffice: ODP, OTP
- Fixed Layout: PDF, PDF/A, XPS
- Images: JPEG, PNG, BMP, TIFF, SVG

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

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.
- Learning Resources
- Documentation
- Source Code
- API References
- Tutorial Videos
- Product Support
- Free Support
- Paid Support
- Why Aspose.Slides Cloud SDK for .NET?
- Customers List

Aspose.Slides Cloud for cURL

Aspose.Slides Cloud for .NET

Aspose.Slides Cloud for Java

Aspose.Slides Cloud for PHP

Aspose.Slides Cloud for Android

Aspose.Slides Cloud for Python

Aspose.Slides Cloud for Ruby

Aspose.Slides Cloud for Node.js

Aspose.Slides Cloud for C++

Aspose.Slides Cloud for Perl

Aspose.Slides Cloud for Swift

Aspose.Slides Cloud for Go

IMAGES
VIDEO
COMMENTS
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.
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 ...
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.
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
//Create a PowerPoint presentation instance · presentation = Presentation ; //Add a blank slide to the PowerPoint instance · slide = presentation.Slides.Add(
Steps to create PowerPoint programmatically: · 'Create a new PowerPoint presentation · Dim powerpointDoc As IPresentation = Presentation.Create() · 'Add a blank
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
You must also use the following using directives or Imports statements to compile the code in this topic. C# Copy. using DocumentFormat.OpenXml;
add-image.cs · Create presentation · var ; add-slide.cs · Instantiate Presentation class that represents the presentation file · Presentation ; create-presentation.cs
PowerPoint.TextRange objText; // Create the Presentation File Presentation pptPresentation = pptApplication.Presentations.Add(MsoTriState.msoTrue); Microsoft.
1 Answer 1 · Cloning Slides including Images and Charts in PowerPoint presentations & Using Open XML SDK 2.0 Productivity Tool · Add Chart on the
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
VSTO: Using C# to Create PowerPoint Presentations: A Practical Guide to Automating PowerPoint Presentation Creation Using Visual Studio Tools for Office.
C# Cloud SDK to help you create & process PowerPoint & OpenOffice presentations in the cloud, without installing any software.