如何使用asp.net在浏览器中打开PowerPoint文件 [英] How to Open Powerpoint file in Browser using asp.net
问题描述
我想直接在浏览器(Google chrome)中打开Powerpoint文件.我正在使用此代码,但是此代码仅直接保存文件.我想在可以查看所有幻灯片的浏览器中打开该Chrome文件.
I want to open Powerpoint file directly in browser(Google chrome). I am using this code, but this code only saves the file directly. I want to open that Chrome file in browser where all slides can be view..
这是我的代码
string filePath = Server.MapPath("~/Attachments/Sample.ppt");
FileInfo file = new FileInfo(filePath);
if (file.Exists)
{
Response.ClearContent();
Response.AddHeader("Content-Disposition", "filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/vnd.ms-powerpoint";
file.IsReadOnly = true;
Response.TransmitFile(file.FullName);
Response.End();
}
但是此代码直接保存文件,但不直接在浏览器(Google Chrome)中显示PowerPoint文件的幻灯片
but this code is saving file directly but not showing the slides of PowerPoint file directly in browser(Google Chrome)
预先感谢...
推荐答案
Response.TransmitFile
旨在将文件作为下载发送给用户.
它正在执行您要求的操作.
The Response.TransmitFile
is meant to send a file as a download to the user.
It is doing what you asked it to do.
如果要将演示文稿嵌入到您的网站中,则必须寻找其他替代方法.这些天的Office使用PowerPoint WebAccess有一些选择
If you want to embed the presentation onto your website you will have to look for other alternatives. Office these days has a few options using PowerPoint webaccess
看看:在您的网站上嵌入演示文稿
这依赖于在线办公室,但是还有许多其他方法可以将您的演示文稿嵌入到网站中. SlideShare 是另一种流行的偏见.
Take a look at: Embed a Presentation on Your Site
This relies on office online, but there are many other ways to embed your presentation on a website. SlideShare is another popular atlernative.
这篇关于如何使用asp.net在浏览器中打开PowerPoint文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!