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. Advertisements

  2. Michael Haberfellner

    mohanprajapati2006

    Joined:
    Jun 25, 2011
    Messages:
    2
    Likes Received:
    0
    mohanprajapati2006, Jun 25, 2011
    #2
    1. Advertisements

  3. Michael Haberfellner

    mohanprajapati2006

    Joined:
    Jun 25, 2011
    Messages:
    2
    Likes Received:
    0
    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. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.