(already created)
public void GenerateXLSXFile(string fileName, ExcelDocument theDocument)
{
string filePath = Server.MapPath("~/TempFiles/" + fileName + ".xlsx");
theDocument.esd_WriteXLSXFile(filePath);
Response.Clear();
Response.AddHeader("Content-Type", "application/vnd.ms-excel");
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ".xlsx");
Response.WriteFile(filePath);
Response.Flush();
System.IO.File.Delete(filePath);
Response.End();
}
No comments:
Post a Comment