Export to excel RRS feed

  • Question

  • User-307546644 posted
    Hi, I am using the following code to export to excel. It's work, but the accentuation (portuguese words) doesn't : //export to excel HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Buffer= true; HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HttpContext.Current.Response.Charset = ""; dg.EnableViewState = false; dg.Visible = true; System.IO.StringWriter oStringWriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); dg.HeaderStyle.Font.Bold = true; dg.RenderControl(oHtmlTextWriter); HttpContext.Current.Response.Write(oStringWriter.ToString()); HttpContext.Current.Response.End(); I know the problem is related to enconding/charset, but I don't know how exactly setup it. Any ideas ?
    Thursday, June 24, 2004 4:45 PM

All replies

  • User-314005982 posted
    add this line:

    Response.ContentEncoding = System.Text.Encoding.UTF7

    if can't work, try other UTF..e.g UTF8, 16

    hope it helps.

    Monday, June 5, 2006 9:14 PM