While it is possible to generate PowerPoint presentations automatically using Office Automation, this is not recommended for use on a server. How can you go about generating a PowerPoint presentation without using Office Automation?
-
As an aside, I have been trying to do some searching for information on PowerPoint XML Presentations, but finding a good combination of keywords for Google is difficult as the keyword PowerPoint has a tendency to return links to presentations that people have written. – rjzii May 05 '09 at 14:54
-
It has to be PowerPoint? There are other formats which could be easier to use. – Grzegorz Gierlik May 05 '09 at 15:01
-
The project specification dictates that it has to be PowerPoint. – rjzii May 05 '09 at 15:28
-
try www.pptxbuilder.com – Boosted_d16 Mar 10 '18 at 00:30
3 Answers
Another option that didn't get mentioned, which was the route we ultimately took, is to make use of the Open XML file formats that are supported naively in Office 2007 and in Office XP via a compatibility pack. Using the Open XML SDK 1.0 getting something working turned out to be surprisingly straightforward.
First, a generic template file was prepared with tokens put in place of the content that would need to be replaced. Next, a reference to DocumentFormat.OpenXml needs to be added to the project. The code itself will reference the DocumentFormat.OpenXml and DocumentFormat.OpenXml.Packaging namespaces. Finally, the code to loop through the slides looks like the following:
// Open the presentation
PresentationDocument presentation = PresentationDocument.Open(fileName, true);
// Loop through all of the slides in the presentation
foreach (SlidePart slide in presentation.PresentationPart.SlideParts)
{
// Read the XML out of the slide
XmlDocument xml = new XmlDocument();
xml.Load(slide.GetStream());
// TODO: Your XML manipulation code here
// Save the updated slide
xml.Save(slide.GetStream());
}
// Save the updated presentation
presentation.Close();

- 14,236
- 12
- 79
- 119
-
-
Not sure if post is stil open as I have question about the code above. I have a service app on Win 2008 that uses Microsoft.Office.Interop.PowerPoint to open the presentation in the background and save it "As" a jpeg - each slides separately. Now however I need to do the same in a web app but the process is unable to to open the pptx file. I have all the admin right on all the accounts, etc. Looking at your code how would you manipulate slide with Open XML? Thanks. – Risho Nov 17 '12 at 16:50
You could write some server-side code that uses a library that can generate PowerPoint format documents. For example, in Java you can use Apache POI-HSLF to generating PPT files programmatically.
Depending on what you need to do, it may be less work to start with a 'template' PPT file, and modify it programmatically to insert or edit content.

- 17,211
- 6
- 50
- 75
If your server-side technology is ASP.NET, you could use Aspose.Slides. It's quite powerful and works well, though it might not be a cost-effective solution, depending on what you want to do.

- 14,098
- 11
- 59
- 83