实现将Web页面的内容,Export To Excel的功能
2006-08-09 15:52
543 查看
public void ToExcel(System.Web.UI.Control ctl, string FileName)
{
HttpContext.Current.Response.Charset = "UTF-8"; // 或UTF-7 以防乱码
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + "" + FileName + ".xls");
ctl.Page.EnableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
ctl.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();
ctl.Page.EnableViewState = true;
}
http://www.cnblogs.com/skywind/archive/2006/08/08/470699.html
相关文章推荐
- 实现将Web页面的内容,Export To Excel的功能
- 利用JQuery实现web页面中table导出excel的功能
- Winform实现抓取web页面内容的方法
- 实现Web页面内容动态改变的dhtml操作
- SpringMVC + Apache POI 实现WEB中Excel下载功能
- js实现对页面的部分内容的打印功能
- Export Grid Data To Excel In Advance Kendo UI Using MVC WEB API And Entity Framework
- asp.net截屏功能实现截取web页面
- 移动端web页面蒙层滚动时页面主体内容不随之滚动的实现方法
- 基于Metronic的Bootstrap开发框架经验总结(9)--实现Web页面内容的打印预览和保存操作
- 使用mod_ext_filter组件在Apache中实现输出内容的替换,为所有页面增加统计功能
- JavaScript将Web页面内容导出到Word及Excel的方法
- 实现Web页面中级联菜单的设计/实现动态加载列表框/实现自动刷新页面/实现Web页面的局部动态更新/实现自动完成功能
- 纯JS实现的读取excel文件内容功能示例【支持所有浏览器】
- 微信开发之移动手机WEB页面(HTML5)Javascript实现一键拨号及短信发送功能
- WebView从assets中加载html5页面,实现定位功能
- JS调用iframe方式实现Web区域打印页面内容
- web项目中实现从网页导出Excel的功能
- 实现Web页面内容动态改变的dhtml操作
- Web页面的仿plsql功能的实现