I want to export data to excel both in .xls and .xlsx format in asp.net MVC without using any third party control.
I tried using following code but it doesn't support .xlsx format.
Response.AddHeader("Content-Disposition", "attachment;
filename=test.xlsx");
Response.ContentType = "application/ms-excel";
Response.Write(sw.ToString());
Response.End();
Pls give me solution.