2016-09-09 3 views
1

Dies ist mein Code zum Herunterladen der Excel-Datei.Wie öffne ich die Excel-Datei in der App, anstatt sie mit C# im Browser herunterzuladen?

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"); 

Ich möchte es in Excel öffnen.

+1

winforms oder webforms oder mvc etc etc? –

+0

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

Antwort

1

Werfen Sie einen Blick auf Office Uri Schemas.

Sie können in Ihre HTML-Seite eine Ansicht Befehl Link wie

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

Diese Links funktionieren verwenden, wenn Büro auf dem Computer installiert ist (auf mobilen Geräten, auch).

Verwandte Themen