asp.net - Generate Powerpoint file on the fly

前端 未结 6 1281
北荒
北荒 2021-02-20 10:11

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

相关标签:
6条回答
  • 2021-02-20 10:40

    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.

    0 讨论(0)
  • 2021-02-20 10:42

    In regards to the previous poster, your statement is incorrect.

    You really only have one option for server side ASP.NET automation of this process. Use the open xml links mentioned by Ben in the original answer...

    Manipulating Excel 2007 and PowerPoint 2007 Files with the Open XML Format API (Part 1 of 2) Manipulating Excel 2007 and PowerPoint 2007 Files with the Open XML Format API (Part 2 of 2)

    The reason for this is that server side automation of office is completely unsupported and is bad coding practise, running com automation servers that are designed for interactive usage in a non-interactive environment is a potential recipe for disaster.

    so in summary use the open xml api and generate your pptx's.

    0 讨论(0)
  • 2021-02-20 10:45

    There are also other third-party options similar to Aspose Slides, such as OfficeWriter's PowerPoint Writer.

    I'm not exactly sure how Aspose Slides works, but with PowerPoint Writer you have an existing, formatted PowerPoint presentation with data markers in it, the you process it with PowerPoint Writer to replace the data markers with data. Here are some examples.

    0 讨论(0)
  • 2021-02-20 10:47

    There's some documentation on MSDN about the OpenXML format that they're using:

    • Manipulating Excel 2007 and PowerPoint 2007 Files with the Open XML Format API (Part 1 of 2)
    • Manipulating Excel 2007 and PowerPoint 2007 Files with the Open XML Format API (Part 2 of 2)
    0 讨论(0)
  • 2021-02-20 10:50

    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.

    0 讨论(0)
  • 2021-02-20 10:57

    there is another method ,convert your power point presentation to images or xps(silver light presentation) and then use some sort of json(jquery) to show and download them.

    i implement the images and xps silver light presentation in my web application

    0 讨论(0)
提交回复
热议问题