A
Asaf
Hi below is the code I am using to export GridView to Excel in Hebrew
character set.
Problem is that sometimes text in Hebrew is ok in the Excel and sometimes it
display as gibberish in the Excel.
How can I solve this problem please?
Kind Regards,
Asaf
protected void btnExportToExcel_Click(object sender, EventArgs e)
{
grvReports.AllowPaging = false;
grvReports.AllowSorting = false;
grvReports.DataBind();
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" +
"MyExcelFile.xls");
Response.ContentType = "application/vnd.xls";
Response.Charset = "1255";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new
HtmlTextWriter(stringWrite);
grvReports.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
//Must set this override function because a bug with the Render
//If not then "btnExportToExcel_Click" will not work!
}
character set.
Problem is that sometimes text in Hebrew is ok in the Excel and sometimes it
display as gibberish in the Excel.
How can I solve this problem please?
Kind Regards,
Asaf
protected void btnExportToExcel_Click(object sender, EventArgs e)
{
grvReports.AllowPaging = false;
grvReports.AllowSorting = false;
grvReports.DataBind();
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" +
"MyExcelFile.xls");
Response.ContentType = "application/vnd.xls";
Response.Charset = "1255";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new
HtmlTextWriter(stringWrite);
grvReports.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
//Must set this override function because a bug with the Render
//If not then "btnExportToExcel_Click" will not work!
}