HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.ContentType = "application/vnd.xlsx"; HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + SheetName + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fff")+".xls"); HttpContext.Current.Response.Charset = "utf-8"; HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1250"); To = Convert.ToDateTime(To).AddDays(-1).ToString("yyyy-MM-dd"); string html = getHTMLtableFromDataTable(dt, SheetName,From, To); HttpContext.Current.Response.Write(style); HttpContext.Current.Response.Output.Write(html); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)