export to excel with special characters

Discussion in 'ASP .Net' started by Michael Haberfellner, Mar 18, 2008.

  1. hi everyone!

    i have to export an allready build csv-text into excel. works fine, but
    when it comes down to displaying special characters (umlaute - as i'm
    from austria where we use those shitty little things ;) my code fails.

    in the variable "locCSV" the text is correct, as if i put it onto screen
    with response.write the characters are displayed perfect!

    here is the code i'm using:

    Response.Clear();
    Response.ContentType = "application/vnd.ms-excel";
    Response.Charset = "UTF-8";
    Response.AddHeader("content-disposition","attachment;filename=Export.csv");
    System.IO.StringWriter locStringWriter = new System.IO.StringWriter();
    locStringWriter.GetStringBuilder().Append(locCSV);
    Response.Write(locStringWriter.ToString());
    Response.End();

    i've searched the internet and tried a lot of things. but nothing
    worked. could anyone of you help me please?

    thanx and greetings from vienna

    mike
     
    Michael Haberfellner, Mar 18, 2008
    #1
    1. Advertising

  2. Michael Haberfellner

    mohanprajapati2006

    Joined:
    Jun 25, 2011
    Messages:
    2
    mohanprajapati2006, Jun 25, 2011
    #2
    1. Advertising

  3. Michael Haberfellner

    mohanprajapati2006

    Joined:
    Jun 25, 2011
    Messages:
    2
    exporting the datatable into excel

    Hello,

    I had written the code for exporting the datatable into excel. You can find the code at link given below



    Mohan Prajapati
     
    mohanprajapati2006, Dec 18, 2013
    #3
    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. Stefan Mueller
    Replies:
    3
    Views:
    33,310
    Stefan Mueller
    Jul 23, 2006
  2. Replies:
    2
    Views:
    1,140
    Ingo Menger
    May 31, 2007
  3. rvino
    Replies:
    0
    Views:
    4,720
    rvino
    Aug 14, 2007
  4. Elisabeth Svensson via .NET 247

    Handling special characters when exporting DataGrid to Excel

    Elisabeth Svensson via .NET 247, Aug 4, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    654
    Pete Fearn
    Dec 21, 2004
  5. majna
    Replies:
    4
    Views:
    781
    Thomas 'PointedEars' Lahn
    Sep 19, 2007
Loading...

Share This Page