Click here to Skip to main content
12,951,971 members (59,660 online)
Click here to Skip to main content
Add your own
alternative version


10 bookmarked
Posted 5 Jun 2014

A Simple Library to Generate PowerPoint Presentations

, 5 Jun 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Generate a PowerPoint presentation, consisting of slides with a title and an image, without requiring Microsoft Office


I needed a simple way to generate a PowerPoint presentation, consisting of slides with a title and an image. Most approaches use the Microsoft Office interop for this, but unfortunately, the application couldn't rely on Microsoft Office to be installed. However, you can download and use the OpenXML SDK 2.5 for Microsoft Office to create a PowerPoint for you, and I've done just that.


This tip basically provides you with a simple library to generate PowerPoint slides consisting of a slide title and image. I cannot take credit for most of the code, however, as I've taken it from existing examples. Specifically, I've reused the code in the below articles, and re-organized them into a library for easy use:

Using the Code

In order to use the code, either include the PowerPointGenerator project, or add a reference to:

  • DocumentFormat.OpenXml.dll
  • PowerPointGenerator.dll

Next, you can use the code as follows:

var powerPointGenerator = new PowerPointFactory
(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "JessicaAlba.pptx"));
var imageFilePaths = Directory.GetFiles(@"..\..\..\Alba", "*.jpg").ToList();

Here, I assume that the generated PowerPoint is saved to the output folder as JessicaAlba.pptx, and it consists of one slide per JPG image in the Alba folder (part of the solution). As I do not specify the titles explicitly, the filename is used as the slide title, but you can also supply a list of titles (one for each slide).

(imageFilePaths, new List<string> { "title 1", "title 2" });

Points of Interest

The OpenXML SDK also contains a tool, OpenXmlSdkTool (in c:\Program Files (x86)\Open XML SDK\V2.5\tool\OpenXmlSdkTool.exe), which converts an existing PowerPoint presentation to a class that can recreate this presentation for you (including the styles, masters, etc.). Pretty amazing, and I've used it to generate the Template.cs class in this project.


  • 2014-06-04 Article written and first version of the code
  • 2014-06-06 Source code couldn't be downloaded - fixed


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Erik Vullings
Netherlands Netherlands
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionCannot download your sample project Pin
fredatcodeproject6-Jun-14 5:52
memberfredatcodeproject6-Jun-14 5:52 
AnswerRe: Cannot download your sample project Pin
Erik Vullings6-Jun-14 12:35
memberErik Vullings6-Jun-14 12:35 
GeneralRe: Cannot download your sample project Pin
fredatcodeproject7-Jun-14 11:52
memberfredatcodeproject7-Jun-14 11:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 5 Jun 2014
Article Copyright 2014 by Erik Vullings
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid