[AcceptVerbs(HttpVerbs.Get)]
public FileResult DownloadSearched(string _file)
{
DataTable dtRec = {Record};
MemoryStream MyMemoryStream = null;
using (XLWorkbook wb = new XLWorkbook())
{
wb.Worksheets.Add(dtRec, "Order");
MyMemoryStream = new MemoryStream();
wb.SaveAs(MyMemoryStream);
MyMemoryStream.WriteTo(Response.OutputStream);
return File(MyMemoryStream, "application/vnd.ms-excel", _file+".xlsx");
}
}
Call from client side:
window.location = "/Report/OrderReport/DownloadSearched?_file=Report
Cheers!
public FileResult DownloadSearched(string _file)
{
DataTable dtRec = {Record};
MemoryStream MyMemoryStream = null;
using (XLWorkbook wb = new XLWorkbook())
{
wb.Worksheets.Add(dtRec, "Order");
MyMemoryStream = new MemoryStream();
wb.SaveAs(MyMemoryStream);
MyMemoryStream.WriteTo(Response.OutputStream);
return File(MyMemoryStream, "application/vnd.ms-excel", _file+".xlsx");
}
}
Call from client side:
window.location = "/Report/OrderReport/DownloadSearched?_file=Report
Cheers!