export dataset to excel

  • Thread starter Thread starter Guest
  • Start date Start date
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???
 
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)
 
hi,

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