1

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.

2
  • 1
    winforms or webforms or mvc etc etc ? Commented Sep 9, 2016 at 11:01
  • Have a read of stackoverflow.com/questions/5648347/… Commented Sep 9, 2016 at 11:05

1 Answer 1

1

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.