worksheet.Tables[0].ShowFilter = true; HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.Clear(); // HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; HttpContext.Current.Response.ContentType = "application/x-msexcel"; HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + strfileName + ".xlsx"); HttpContext.Current.Response.AddHeader("Content-Length", package.GetAsByteArray().Length.ToString()); //HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); HttpContext.Current.Response.ContentEncoding = System.Text.UTF8Encoding.UTF8; if (HttpContext.Current.Response.IsClientConnected) { HttpContext.Current.Response.BinaryWrite(package.GetAsByteArray()); } HttpContext.Current.Response.Flush(); HttpContext.Current.Response.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)