hi...
I am Exporting chinese data to Microsoft Excel....while exporting sometimes chinese chars appears as special chars in the excel sheet and sometimes not.I have tried lot many thing for making it consistent.I have used following code.DataTable oDt;
Response.Clear();
Response.Buffer=true;
Response.AddHeader("content-disposition", "attachment;filename=file.xls");
//Response.Charset = "";
Response.ContentEncoding = System.Text.Encoding.UTF7;
Response.Cache.SetCacheability(HttpCacheability.Private);
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter stringWrite =
System.Web.UI.HtmlTextWriter htmlWrite =
StringBuilder sbHTML =
rm =
sbHTML.Append("<table border='2'>");
sbHTML.Append("<tr>");
sbHTML.Append("<td align=center style='FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: white; BACKGROUND-COLOR: #528ee7; WIDTH:215px'>" + rm.GetString("lblName") + "</td>");
sbHTML.Append("<td align=center style='FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: white; BACKGROUND-COLOR: #528ee7; WIDTH:85px'>" + rm.GetString("lblSurname") + "</td>");
sbHTML.Append("</tr>");
rm.ReleaseAllResources();
{
sbHTML.Append("<TD align=left>" + dr["Name"] + "</TD>");
sbHTML.Append("<TD align=left>" + dr["Surname"] + "</TD>");
}
sbHTML.Append("</table>");
Response.Write(sbHTML.ToString());
Response.End();Please anybody...suggest a consistent solution for this problem.