【问题标题】:How to open Excel file in app instead of downloading in browser using C#?如何在应用程序中打开 Excel 文件,而不是使用 C# 在浏览器中下载?
【发布时间】:2016-09-09 10:59:36
【问题描述】:

这是我下载 Excel 文件的代码。

HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.AppendHeader("content-disposition", "attachment ; filename=report.xlsx"); 

我想在 Excel 中打开它。

【问题讨论】:

标签: c# closedxml


【解决方案1】:

看看Office Uri Schemas

您可以在您的 html 页面中使用查看命令链接,例如

<a href="ms-excel:ofv|u|http://contoso/Q4/budget.xls">Open in Excel</a>

如果办公室安装在计算机上(移动设备上也是如此),则这些链接有效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-11-08
    • 2019-03-08
    • 1970-01-01
    • 2012-06-14
    • 2013-10-25
    • 1970-01-01
    相关资源
    最近更新 更多