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
文章首发
查看全文
相关阅读:
html5——渐变
html5——背景
html5——边框
html5——私有前缀
html5——盒子模式
html5——文本阴影
html5——颜色
html5——css选择器
html5——DOM扩展
html5——多媒体(一)
原文地址:https://www.cnblogs.com/skywind/p/470699.html
最新文章
2017-2018-2 20165325 实验二《Java面向对象程序设计》实验报告
第六周 学习总结
第五周 学习总结
20165315 C语言学习情况与Java学习目标
20165315 我所期望的师生关系
20165225《Java程序设计》第四周学习总结
20165225《Java程序设计》第三周学习总结
预备作业3:Linux安装及命令入门
预备作业2 :学习基础和C语言基础调查
预备作业1:你期望的师生关系是什么?
热门文章
html5——动画案例(太阳系)
html5——动画
html5——3D案例(立体导航)
html5——3D案例(立体汉字,旋转导航)
html5——3D案例(立方体)
html5——3D案例(音乐盒子、百度钱包)
html5——3D转换
html5——:hover事件触发自己的:afert伪元素事件
html5——2D转换
html5——过渡
Copyright © 2011-2022 走看看