Context.Response.Clear(); Context.Response.ContentType = "application/ms-excel"; Context.Response.ContentEncoding = System.Text.UnicodeEncoding.UTF8; Context.Response.Charset = "UTF-8"; Context.Response.AddHeader("content-disposition", string.Format("attachment; filename=Download.xls")); using (System.IO.StringWriter sw = new System.IO.StringWriter()) { using (HtmlTextWriter htw = new HtmlTextWriter(sw)) { ExcellExport.RenderControl(htw); Context.Response.Write(htw.ToString()); // HttpContext.Current.Response.Write(htw.ToString()); Context.Response.End(); Context.Response.Flush(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)