zoukankan
html css js c++ java
datagrid gridview 倒出数据为 excel 时,编号问题
把gridview 中的数据倒出 为 excel时 (编号长时在 excel 中会变成科学计数)
//
倒出按钮
protected
void
Btn_ExportClick(
object
sender, EventArgs e)
{
string
style
=
@"
<style> .text { mso-number-format:\@; } </script>
"
;
//
主要是这
Response.ClearContent();
Response.AddHeader(
"
content-disposition
"
,
"
attachment; filename=MyExcelFile.xls
"
);
Response.ContentType
=
"
application/excel
"
;
StringWriter sw
=
new
StringWriter();
HtmlTextWriter htw
=
new
HtmlTextWriter(sw);
gvUsers.RenderControl(htw);
//
Style is added dynamically
Response.Write(style);
Response.Write(sw.ToString());
Response.End();
}
//
行绑定事件
protected
void
gvUsers_RowDataBound(
object
sender, GridViewRowEventArgs e)
{
if
(e.Row.RowType
==
DataControlRowType.DataRow)
{
e.Row.Cells[
4
].Attributes.Add(
"
class
"
,
"
text
"
);
//
主要是这
}
}
具体可以看这
http://gridviewguy.com/ArticleDetails.aspx?articleID=197
查看全文
相关阅读:
分布式锁的三种实现方式
sharding-jdbc
MySQL Proxy 实现 MySQL 读写分离提高并发负载
python 使用流式游标 读取mysql怎么不会内存溢出
数据仓库方案
MySQL percona-toolkit工具详解
percona-toolkit 主从工具 master-slave
MySQL sql join 算发
MySQL5.7.6 general tablespace
MySQL Data Directory -- Creating file-per-table tablespaces outside the data directory
原文地址:https://www.cnblogs.com/gwazy/p/484373.html
最新文章
poj2176 Folding【区间DP】
CH5E07 划分大理石【多重背包】
poj1722 SUBTRACT【线性DP】
poj1934 Trip【线性DP】【输出方案】
记一次缓存瓶颈处理
saltstack安装
应用日志获取-web系统
zipfile模块
客户端访问不可达故障集
tracert查网络问题
热门文章
django_ORM操作数据库
mysql编码
django_uWSGI+nginx环境
管理现有数据库-web系统
MySQL 5.6 中一个重要的优化——Index Condition Pushdown,究竟push down了什么
MySQL 中Redo与Binlog顺序一致性问题
MySQL 中索引的长度的限制
开源分布式中间件 DBLE 快速入门指南
MySQL 使用连接池封装pymysql
分布式锁的三种实现方式 数据库、redis、zookeeper
Copyright © 2011-2022 走看看