Reputation: 51
This is my code to download Excel file.
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");
I want to open it in Excel.
Upvotes: 1
Views: 448
Reputation: 15415
Have a look at Office Uri Schemas.
You can use in your html page a view command link like
<a href="ms-excel:ofv|u|http://contoso/Q4/budget.xls">Open in Excel</a>
These links work if office is installed on the computer (on mobile devices, too).
Upvotes: 1