Function ToExcel(ByVal ctl As System.Web.UI.Control) With HttpContext.Current.Response .Charset = "UTF-8"
.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8")
.ContentType = "Application/ms-excel" End With
HttpContext.Current.Response.AppendHeader("content-Disposition", "attachment;filename=" & HttpUtility.UrlEncode(Title1) & ".xls")
ctl.Page.EnableViewState = False
Dim tw As System.IO.StringWriter = New System.IO.StringWriter()
tw.WriteLine(Title1)
tw.Write(Chr(13) & Chr(10))
tw.WriteLine(Source)
Dim hw As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(tw)
ctl.RenderControl(hw) HttpContext.Current.Response.Write(tw.ToString) HttpContext.Current.Response.End() End Function
.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8")
.ContentType = "Application/ms-excel" End With
HttpContext.Current.Response.AppendHeader("content-Disposition", "attachment;filename=" & HttpUtility.UrlEncode(Title1) & ".xls")
ctl.Page.EnableViewState = False
Dim tw As System.IO.StringWriter = New System.IO.StringWriter()
tw.WriteLine(Title1)
tw.Write(Chr(13) & Chr(10))
tw.WriteLine(Source)
Dim hw As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(tw)
ctl.RenderControl(hw) HttpContext.Current.Response.Write(tw.ToString) HttpContext.Current.Response.End() End Function
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货