zoukankan
html css js c++ java
实现将Web页面的内容,Export To Excel的功能
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://free56.cn/post/4.html
文章首发
查看全文
相关阅读:
2.六角星绘制
1.五角星绘制
Redis
javaScript
反射
区分'方法'和'函数'
递归,二分法
匿名函数,排序函数,过滤函数,映射函数,
生成器,生成器函数,推导式,生成器表达式.
函数,闭包,迭代器
原文地址:https://www.cnblogs.com/skywind/p/470699.html
最新文章
Spring 读取 properties
设计模式(一) 单例模式
JS 判断数据类型以及转换
ES5-正则表达式-15.10.2.8 Atom
ES5-正则表达式-15.10.2.5 选择项(Term)
ES5-正则表达式-15.10.2.3 析取Disjunction
[网络流二十四题]最小路径覆盖问题
[网络流]Drainage Ditches(草地排水)
[线段树]picture
[线段树]模板2
热门文章
[线段树]模板1
[树状数组]求排列的逆序数
[树状数组]翠湖战争
[树状数组]模板
[欧拉回路]无序字母对
[矩阵快速幂] 数列(类斐波那契
Python 的第二周作业
python123第一周作业
4.说说心里话
3.叠加等边三角形
Copyright © 2011-2022 走看看