What are the alternative ways to export excel file

Posted by fealin on Stack Overflow See other posts from Stack Overflow or by fealin
Published on 2010-04-29T13:57:43Z Indexed on 2010/04/29 14:17 UTC
Read the original article Hit count: 294

Filed under:
|
|

i m trying to generate an excel file from my web page but i have some issues with Turkish chars such as "I" "g" when i open the file some chars are incorrect (I seems Ä°) here is my code

    gvExpRequests.DataSource = dsExpRequests;
    gvExpRequests.DataBind();
    gvExpRequests.GridLines = GridLines.Both;
    Page.EnableViewState = false;
    Response.Clear();
    Response.AddHeader("content-disposition", "attachment;filename=export.xls");
    Response.ContentType = "application/ms-excel";
    Response.ContentEncoding = Encoding.UTF8;
    Response.BinaryWrite(Encoding.UTF8.GetPreamble());
    StringWriter yaz = new StringWriter();
    HtmlTextWriter htw = new HtmlTextWriter(yaz);
    gvExpRequests.RenderControl(htw);

i don't know what's wrong with here i tried a lot of encoding but i got same results every time i want to try something different to do this are there any another way to export a excel file from a gridview

© Stack Overflow or respective owner

Related posts about c#

Related posts about excel