C
Code Monkey
I'm exporting the contents of a GridView (in C# v2) into Excel.
However, whilst the GridView displays on the web page correctly, when
the data is in Excel, I get a lot of  characters appearing ('A' with
a hat on top) where there are numbers (ie; order numbers and line
totals).
Is there an easy way to remove these?
The code I'm using looks like:
<code>
protected void btn_export_Click(object sender, EventArgs e)
{
Response.Clear();
String fileName = Invoice";
Response.AddHeader("content-disposition",
string.Format("attachment;filename={0}.xls", fileName));
Response.Charset = "";
Response.ContentType = "application/vnd.xls";
Response.Write(sb.ToString());
Response.Write(Session["ExcelDataGrid"].ToString());
Response.End();
}
</code>
and I've got
<code>
<globalization requestEncoding="utf-8" responseEncoding="utf-8"
culture="en-GB"/>
</code>
in my web.config file.
However, whilst the GridView displays on the web page correctly, when
the data is in Excel, I get a lot of  characters appearing ('A' with
a hat on top) where there are numbers (ie; order numbers and line
totals).
Is there an easy way to remove these?
The code I'm using looks like:
<code>
protected void btn_export_Click(object sender, EventArgs e)
{
Response.Clear();
String fileName = Invoice";
Response.AddHeader("content-disposition",
string.Format("attachment;filename={0}.xls", fileName));
Response.Charset = "";
Response.ContentType = "application/vnd.xls";
Response.Write(sb.ToString());
Response.Write(Session["ExcelDataGrid"].ToString());
Response.End();
}
</code>
and I've got
<code>
<globalization requestEncoding="utf-8" responseEncoding="utf-8"
culture="en-GB"/>
</code>
in my web.config file.