开发者

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

Does any开发者_开发知识库one have a PowerPoint viewer which I can embed in an ASP.NET Web App?


If you are using Silverlight you can use

http://pptx2silverlight.codeplex.com/


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜