AhmedHindy
asked on
export grid view to excel encoding problem
i am exporting grid view into excel
but i am having problem in encoding
arabic characters are not displayed properly
any help ??? !!!!!!
but i am having problem in encoding
arabic characters are not displayed properly
public void ExportGridViewToExcel(HttpResponse Response, GridView GridView_Excel)
{
string attachment = "attachment; filename=Transactions.xls";
Response.ClearContent();
HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding("utf-8");
HttpContext.Current.Response.Charset = "utf-8";
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView_Excel.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
any help ??? !!!!!!
public void ExportGridViewToExcel(HttpResponse Response, GridView GridView_Excel)
{
string attachment = "attachment; filename=Transactions.xls";
Response.ClearContent();
HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding("utf-8");
HttpContext.Current.Response.Charset = "utf-8";
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView_Excel.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
it worked
ASKER
add this and it worked
:)
Response.Charset = "";
:)
Response.Charset = "";
http://weblogs.asp.net/gunnarpeipman/archive/2007/09/16/exporting-gridview-data-to-excel.aspx
http://www.aspdotnetcodes.com/Export_GridView_To_Excel_With_Image.aspx