| Below is the code for importing data from Gridview to excel. And we used UTF8 encoding values
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.Buffer = true;
System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Charset = "UTF-8";
System.Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=FileName1.xls");
System.Web.HttpContext.Current.Response.ContentType = "application/excel";
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
System.Web.HttpContext.Current.Response.ContentEncoding = Encoding.Default;
GridView1.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
| | |