实现将Web页面的内容,Export To Excel的功能
来源:互联网 发布:mac改用户名丢失管理员 编辑:程序博客网 时间:2024/05/17 01:40
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;
}
{
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的功能
- 利用JQuery实现web页面中table导出excel的功能
- 使用JavaScript将Web页面内容导出到Word、Excel
- ASP.NET Export to Excel(导出数据到Excel) & C#导出Excel,某单元格内容长度超过255的处理方法
- 使用Web Datawindow ActiveX实现Web页面的打印功能
- 实现Web页面内容动态改变的dhtml操作
- 实现Web页面内容动态改变的dhtml操作
- 实现Web页面内容动态改变的dhtml操作
- web项目中实现从网页导出Excel的功能
- Web页面的仿plsql功能的实现
- Export DataSets to Excel...
- export to excel
- Export GridView to Excel
- Export to excel
- Export to Excel
- EXCEL export to TXT
- Export to excel
- Pocket Outlook对象使用:访问短消息服务
- eMule协议说明书(翻译二)
- .Net分页控件发布
- 用Split()方法提取字符
- 行号清除器
- 实现将Web页面的内容,Export To Excel的功能
- 关于23种设计模式的有趣见解
- 读书计划
- Borland的Turbo系列又回来了!
- Dynamic linking in Linux and Windows
- 《asp.net 2.0 开发指南》读书笔记之三 4.5 面向对象的特性
- 一个简单的怪问题
- 利用Repeater控件来分页显示
- js日历