I’m using this code to export data from a repeater to an Excel sheet:
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment;filename=Clientes.xls");
Response.Charset = "";
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
Repeater1.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
Excel sheet when is displayed contains data from repeater, notwithstanding accents and Spanish letter ñ containing within data are not drawing correctly, e.g.:
México it is drawing as México
López it is drawing as López
Villafaña it is drawing as Villafaña
María it is drawing as MarÃa
¿Does somebody knows what is the reason about it and how can I fix it?
I’ll appreciate your help.
A.L.
Enter your message below
Sign in or Join us (it's free).