C# 如何使用asp.net在浏览器中打开Powerpoint文件
我想直接在浏览器(谷歌浏览器)中打开Powerpoint文件。我正在使用此代码,但此代码仅直接保存文件。我想在浏览器中打开Chrome文件,在那里可以查看所有幻灯片 这是我的密码C# 如何使用asp.net在浏览器中打开Powerpoint文件,c#,asp.net,vb.net,C#,Asp.net,Vb.net,我想直接在浏览器(谷歌浏览器)中打开Powerpoint文件。我正在使用此代码,但此代码仅直接保存文件。我想在浏览器中打开Chrome文件,在那里可以查看所有幻灯片 这是我的密码 string filePath = Server.MapPath("~/Attachments/Sample.ppt"); FileInfo file = new FileInfo(filePath); if (file.Exists) {
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文件的幻灯片
提前感谢…响应。TransmitFile旨在将文件作为下载发送给用户。
它在做你让它做的事 如果你想将演示文稿嵌入你的网站,你必须寻找其他替代方案。Office现在有一些使用PowerPoint webaccess的选项 看看:
这依赖于OfficeOnline,但有许多其他方法可以将演示文稿嵌入网站。是另一种流行的语言