User-1775491976 posted
Hi All
I'm using this Code for Exporting Gridview to Excel file
and it works fine for Alllllllll Pages and Grids
But only one have problem I don't know why !!! ( The Problem is Special Character in header Like كود الصن٠)
Please Help
and remember again ( it works correctly for all gridviews in my project but only one has this problem )
Response.Clear();
Response.Buffer = true;
Response.ClearContent();
Response.ClearHeaders();
Response.Charset = "";
string FileName = "Search Kill Prods " + DateTime.Now.ToString("dd/MM/yyyy") + ".xls";
StringWriter strwritter = new StringWriter();
HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
GridKill.GridLines = GridLines.Both;
GridKill.AllowPaging = false;
GridKill.ShowHeader = true;
GridKill.HeaderRow.ForeColor = System.Drawing.Color.White;
GridKill.HeaderStyle.Font.Bold = true;
GridKill.RenderControl(htmltextwrtter);
Response.Write(strwritter.ToString());
Response.End();