日期:2014-05-19  浏览次数:20559 次

html table中的数据导出excel表的时候为乱码,请问如何解决?
--代码如下
 
 
                Response.AddHeader( "Content-Disposition ",   "attachment;   filename=ExcelFile ")
                Response.Charset   =   "UTF-8 "
                Response.ContentType   =   "application/vnd.ms-excel "
                Response.Charset   =   " "
                Me.EnableViewState   =   False
                Dim   tw   As   New   System.IO.StringWriter
                Dim   hw   As   New   System.Web.UI.HtmlTextWriter(tw)
                tblsbu.RenderControl(hw)
                Response.Write(tw.ToString())
                Response.End()

------解决方案--------------------
Response.ContentType = "application/vnd.ms-excel "
Response.AddHeader( "Content-Disposition ", "attachment; filename=ExcelFile ",Encoding.UTF8)

Me.EnableViewState = False
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
tblsbu.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()