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
文章首发
查看全文
相关阅读:
性能测试基础篇
Jmeter参数化
斐波那契
Web安全 概述
HTTP 协议详解
echarts 响应式布局
vue 结合mint-ui Message box的使用方法
vue 中使用iconfont Unicode编码线上字体图标的流程
手机端@media的屏幕适配
@media响应式的屏幕适配
原文地址:https://www.cnblogs.com/skywind/p/470699.html
最新文章
转载:VS项目属性配置总结
OpenCV:直线拟合——cv::fitLine()详解
exe加载DLL的时候会有一系列的搜索路径
转载:C++函数中new一块内存,作为返回值
转载:明明白白VC LIB和DLL的使用
转载:HTuple数据和VC数据的相互赋值
转载:镜头分辨率(解像力)参数
转载:老生常谈C++中实参形参的传递问题
看到的一个关于C++能力分级的描述
linux上安装mysql5.7
热门文章
docker-compose运行mysql
修改docker安装的mysql密码
linux退出vi编辑
linux下docker和docker-compose的安装与使用
docker的安装与使用
mysql常用命令(备忘)
docker常用命令(备忘)
docker搭建maven私服
git回退到某个历史版本
Jmeter组件执行顺序与作用域
Copyright © 2011-2022 走看看