I was given some help the day before yesterday,and I really appreciate your help,I tried it,but the encoding problem still exist,for example,the Chinese characters "哈哈" in my datagrid,when exporting to Excel,the words"哈哈"become
another words like"1p1p",I don't know why,and I don't know what problem it is.An upperclassman tell me that it's an encode problem,Chinese characters using Unicode. I use it in my programme(you will see ),but it cut no ice.Can anybody tell me,what's wrong?This
problem has puzzled me for many days,I am now thinking and trying it the all day.
I want to export datagrid to excle using:
Private Sub DataToExcel()
Response.ContentType="application/vnd.ms-excel"
//Here,what should I write?
//I have tried this: Response.ContentEncoding=System.Text.UTF8Encoding.Default
//But it can't work.
//Now I use this ,but the problem still exist.
Response.ContentEncoding=System.Text.UnicodeEncoding.Default
Response.AppendHeader("Content-Disposition","attachment;filename=Reporte.xls;")
Me.EnableViewState=false
Response.charset=""
Dim stringwrite as New System.IO.StringWriter
Dim htmlwrite as New System.Web.UI.HtmlTextWriter(stringwrite)
RenderControl(htmlwrite)
Response.write(stringwrite.Tostring)
Response.End()
End Sub
I am a student from China,my English is poor,so sorry,but Thank you very much.
(Response.ContentEncoding=System.Text.UnicodeEncoding.Default)
to
(Response.ContentEncoding = System.Text.Encoding.UTF8)
or
(Response.ContentEncoding = System.Text.Encoding.UTF7)
None
0 Points
6 Posts
Still Encode Problem!Who can tell me what's wrong?Thank you.
Jul 29, 2005 10:34 PM|dadamushroom|LINK
I was given some help the day before yesterday,and I really appreciate your help,I tried it,but the encoding problem still exist,for example,the Chinese characters "哈哈" in my datagrid,when exporting to Excel,the words"哈哈"become another words like"1p1p",I don't know why,and I don't know what problem it is.An upperclassman tell me that it's an encode problem,Chinese characters using Unicode. I use it in my programme(you will see ),but it cut no ice.Can anybody tell me,what's wrong?This problem has puzzled me for many days,I am now thinking and trying it the all day.
I want to export datagrid to excle using:
Private Sub DataToExcel()
Response.ContentType="application/vnd.ms-excel"
//Here,what should I write?
//I have tried this: Response.ContentEncoding=System.Text.UTF8Encoding.Default
//But it can't work.
//Now I use this ,but the problem still exist.
Response.ContentEncoding=System.Text.UnicodeEncoding.Default
Response.AppendHeader("Content-Disposition","attachment;filename=Reporte.xls;")
Me.EnableViewState=false
Response.charset=""
Dim stringwrite as New System.IO.StringWriter
Dim htmlwrite as New System.Web.UI.HtmlTextWriter(stringwrite)
RenderControl(htmlwrite)
Response.write(stringwrite.Tostring)
Response.End()
End Sub
I am a student from China,my English is poor,so sorry,but Thank you very much.
Contributor
4150 Points
5249 Posts
Re: Still Encode Problem!Who can tell me what's wrong?Thank you.
Oct 14, 2005 03:28 PM|Caddre|LINK
(Response.ContentEncoding=System.Text.UnicodeEncoding.Default)
to
(Response.ContentEncoding = System.Text.Encoding.UTF8)
or
(Response.ContentEncoding = System.Text.Encoding.UTF7)
Hope this helps.