Problem to Export in Excel data format

Discussion in 'ASP .Net' started by Alessandro, Jun 9, 2005.

  1. Alessandro

    Alessandro Guest

    Hi !
    I have a table on an aspx page and i want to export its rows into an Excel
    File, the script is

    Page.Response.Clear()
    Page.Response.ClearContent()
    Page.Response.ClearHeaders()

    Me.TBLexcel.RenderControl(oHTMLWriter)
    Page.Response.Write("<html><head></head><body>")
    Page.Response.Write(oStringWriter)
    Page.Response.Write("</body></html>")
    Response.charset="utf-8"
    Dim OpenType As String = "attachment"
    Page.Response.ContentType = "application/ms-excel"
    Page.Response.AddHeader("Content-Disposition", OpenType + ";filename="
    +FileName)
    Page.Response.End()


    But, if i open the file with notepad i find= Members of community Facoltà
    di Economia
    if i open the file with excel i find= Members of community Facoltà di
    Economia


    so, there is a problem with encoding, but i don't understand where !
     
    Alessandro, Jun 9, 2005
    #1
    1. Advertising

  2. Alessandro

    Alessandro Guest

    The complete code:


    Dim FileName As String = "Iscritti.xls"
    Dim oStringWriter As System.IO.StringWriter = New System.IO.StringWriter
    Dim oHTMLWriter As New System.Web.UI.HtmlTextWriter(oStringWriter)
    Page.Response.Clear()

    Me.TBLexcel.RenderControl(oHTMLWriter)
    Dim OpenType As String = "attachment"
    Page.Response.ContentType = "application/ms-excel"
    Page.Response.AddHeader("Content-Disposition", OpenType + ";filename=" +
    FileName)
    Page.Response.Write(oStringWriter)
    Page.Response.End()


    The problem is with object "oStringWriter ",it uses unicode and not UTF-8,
    but it's not possible to change this encoding
     
    Alessandro, Jun 9, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGF2aWQgVmFsbGU=?=

    Invalid export DLL or export format

    =?Utf-8?B?RGF2aWQgVmFsbGU=?=, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    3,640
    =?Utf-8?B?RGF2aWQgVmFsbGU=?=
    Oct 29, 2003
  2. Peter
    Replies:
    1
    Views:
    10,079
    Steve C. Orr [MVP, MCSD]
    Nov 9, 2004
  3. Julien
    Replies:
    1
    Views:
    13,869
    Steve C. Orr [MVP, MCSD]
    Feb 28, 2005
  4. Replies:
    3
    Views:
    11,412
    Patrick.O.Ige
    May 24, 2006
  5. CDonlan
    Replies:
    0
    Views:
    939
    CDonlan
    Jun 19, 2007
Loading...

Share This Page