export to excel with special characters

  • Thread starter Michael Haberfellner
  • Start date
M

Michael Haberfellner

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
 
Joined
Jun 25, 2011
Messages
2
Reaction score
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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,737
Latest member
Georgeengab

Latest Threads

Top