How can I view a PowerPoint in an ASP.NET application?

社会主义新天地 提交于 2020-02-08 08:32:01

问题


Does anyone have a PowerPoint viewer which I can embed in an ASP.NET Web App?


回答1:


If you are using Silverlight you can use

http://pptx2silverlight.codeplex.com/




回答2:


You can't directly embed a PPT/presentation to view. Instead you can try any converter that allows you to embed the PPT slide as images or some other format that the client browser can render to the user. There are few products like GroupDocs viewer or Doconut viewer that do this. You can give it a try.




回答3:


You will have to convert the PowerPoint slides in the form, i.e. images or HTML pages, that can be embedded in your web page. You may try GroupDocs.Viewer for .NET that allows rendering the presentation slides into high-fidelity images (PNG/JPG) or the HTML pages. You can then embed the rendered pages into your web page to preview the slides. This is how you can render the slides:

Rendering as Image:

using GroupDocs.Viewer.Options;

// Set output path 
string OutputPagePathFormat = Path.Combine("C:\\output", "page_{0}.png");
// Render document pages
using (Viewer viewer = new Viewer("C:\\sample.pptx"))
{
    PngViewOptions options = new PngViewOptions(OutputPagePathFormat);
    viewer.View(options);
    // Rendered images will be saved in the D:\output\ directory.
}

Rendering as HTML:

using GroupDocs.Viewer.Options;

// The file path format 
string OutputPagePathFormat = Path.Combine("C:\\output","page-{0}.html");
using (Viewer viewer = new Viewer("C:\\sample.pptx"))
{       
   HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(OutputPagePathFormat);
   viewer.View(options);
}

Disclosure: I work as a developer evangelist at GroupDocs.



来源:https://stackoverflow.com/questions/4461620/how-can-i-view-a-powerpoint-in-an-asp-net-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!