export dataset to excel

G

Guest

Hello,

I have a dataset that has information written in Swedish language, that
means alot of stranch chars like 'Å, Ä, Ö' etc and my code
void Export(datagrid myDataGrid){
Response.Clear();

Response.AddHeader("content-disposition","attachment;filename=FileName.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
myDataGrid.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();}
this exports a file and replaces the swedish chars to something else like
ö.. Do you have any code sample or idea how to fix that???
 
G

Guest

hi mark
what should it be???
Response.charst = "ASCII" is not helping?
--
LZ






- Show quoted text -

Hej Lamis

try to set encoding

Response.ContentEncoding = System.Text.Encoding.GetEncoding(1252)
 
G

Guest

hi,

Response.ContentEncoding = System.Text.Encoding.GetEncoding(1252) worked
perfectly.. thank's ALOT for your help
 

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

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top