问题描述
- 下面代码是导出到excel函数的?
-
this.dg.Columns[3].Visible = false;
HttpContext.Current.Response.Charset = "GB2312";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("out.xls", System.Text.Encoding.UTF8)); HttpContext.Current.Response.ContentType = "application/ms-excel"; this.EnableViewState = false; System.IO.StringWriter tw; tw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw; hw = new HtmlTextWriter(tw); this.dg.RenderControl(hw); HttpContext.Current.Response.Write(tw.ToString()); HttpContext.Current.Response.End(); this.dg.Columns[3].Visible = true;
解决方案
armchat 和 导出excel代码
vb.net导出数据到Excel代码
NPOI导出Excel,简单实现代码
解决方案二:
据我所知,应该是的,但是还是不太了解哈
时间: 2024-09-17 23:57:03