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
查看全文
相关阅读:
python 有关datetime时间日期 以及时间戳转换
开园杂记
vue beforeRouteEnter 注意点
html 头像裁剪框
window server服务器配置ftp服务
js 使用 delete 删除对象的属性
win 自带的截屏工具
idea 配置新建类自动加注解
mysql varchar 使用唯一索引时无法区分大小写 可以使用varbinary
在 laradock 环境中使用 laravel-swoole 加速你的 laravel 应用
原文地址:https://www.cnblogs.com/gwazy/p/484373.html
最新文章
Spyder中figure显示设置
ubuntu 中安装 ZED SDK 及结合ROS 的使用
Presentation 常用的承接句——技术分享、学术报告串联全场不尴尬
在windows 8.1 64位配置python和opencv
学习React框架-总结
AnyConnect使用说明(Mac电脑)
学SQL(WHERE(2)、NOT、IN、通配符、正则表达式)
学SQL(Select,order by,where(1))
学SQL(简介)
生成学习算法(Generative Learning algorithms)
热门文章
广义线性模型(Generalized Linear Models)
分类和逻辑回归(Classification and logistic regression)
局部加权线性回归(Locally weighted linear regression)
回归问题中代价函数选择的概率解释(Probabilistic interpretation)
梯度下降(Gradient descent)
监督学习(Supervised learning)
VisualSVN Server的配置和使用
IC卡、ID卡、M1卡、射频卡的区别是什么
XGBoost原理
python 中 urlparse 模块介绍
Copyright © 2011-2022 走看看