I have a client of my web based application who heavily uses the data from our system for powerpoint presentations.
We currently allow data to export in more traditional file types...PDF, CSV, HTML, and a few others. Powerpoint doesn't seem to be really automated.
Is there a way, on the ASP.NET server side, to automate the creation and on-demand download of a powerpoint file format for a report from a system?
There's some documentation on MSDN about the OpenXML format that they're using:
In this article, Steve suggests using Aspose's Slide application.
He also explains step by step on how to generate the PowerPoint file.
Here are some code excerpts (in VB):
Opening an existing PowerPoint file:
Dim fs As System.IO.FileStream = _
New System.IO.FileStream("c:\mypath\myfile.ppt", _
System.IO.FileMode.Open, System.IO.FileAccess.Read)
Dim MyPres As Presentation = New Presentation(fs)
fs.Close()
Looping the slides and outputting their template formats:
Dim slides As Slides = MyPres.Slides
For i As Integer = 0 To slides.Count - 1
Response.Write(MyPres.Slides(i).Layout.ToString + "<br>")
Next
In his article, he describes more in detail on how to do it.
Well you have two ways of really doing this, without third party tools. The first would be with Automation of PowerPoint, but that requires that your server have PowerPoint installed. The second is to utilize the new pptx file file format and generate the powerpoint document using XML.
I have found that the best way to get started on the XML side is to simply create a powerpoint that does what you want, then save it and look at the XML. You can also review the microsoft documentation. Overall working with the XML formats is pretty easy.
Lastly, there might be some third party items out there, but be careful that they don't require COM automation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With