2016-09-09 28 views
1

這是我的代碼來下載Excel文件。如何在應用程序中打開Excel文件而不是使用C#在瀏覽器中下載?

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中打開它。

+1

winforms或webforms或mvc等等? –

+0

閱讀http://stackoverflow.com/questions/5648347/how-to-open-an-excel-document-using-c-sharp –

回答

1

看看Office Uri Schemas

您可以在HTML頁面中使用視圖命令鏈接像

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

如果安裝在計算機上的辦公室(在移動設備上,太)這些環節的工作。

相關問題