'Excel Export using ClosedXML.Excel.dll in ASP.NET MVC
Getting error when call GetAllProduct method to export excel data.
Server Error in '/' Application. Could not load file or assembly 'FastMember, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
public void GetAllProduct()
{
var dtable = _productmasterService.GetProductMasterData(ManageSession.UserId);
using (XLWorkbook wb = new XLWorkbook())
{
wb.Worksheets.Add(dtable);
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment;filename=List of Products_" + DateTime.Now.Ticks.ToString() + ".xlsx");
using (MemoryStream myMemoryStream = new MemoryStream())
{
wb.SaveAs(myMemoryStream);
myMemoryStream.WriteTo(Response.OutputStream);
myMemoryStream.Position = 0;
myMemoryStream.Close();
Response.Flush();
Response.End();
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
