当前位置: 首页 > news >正文

[Asp.Net]GridView导出Excel长数字显示成科学计数

类似身份证纯数字的格式时 ,excel默认是数字格式 变成了科学计数法 ,

GridView:RowDataBound

添加e.Row.Cells[2].Attributes.Add(“style”, “vnd.ms-excel.numberformat:@;”);

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //你的身份证是第3列,只需将其格式化为字符即可。 e.Row.Cells[2].Attributes.Add("style", "vnd.ms-excel.numberformat:@;");        } 
}

Repeater

添加:
style=“vnd.ms-excel.numberformat:@”

<th scope="col"><%# DataBinder.Eval(Container.DataItem,"[性别]") %></th><th scope="col" style="vnd.ms-excel.numberformat:@"><%# DataBinder.Eval(Container.DataItem,"[出生日期]") %></th>
<th scope="col" style="vnd.ms-excel.numberformat:@"><%# (DataBinder.Eval(Container.DataItem,"[身份证号码]")).ToString() %></th><th scope="col"><%#(DataBinder.Eval(Container.DataItem,"[手机号码]")).ToString()  %></th>

文章转载自:

http://ExDO2Mzc.tnLnq.cn
http://9BjF3eNr.tnLnq.cn
http://A0yrFqWm.tnLnq.cn
http://1JWHtH8k.tnLnq.cn
http://pPkrdNgS.tnLnq.cn
http://3gNkvXj2.tnLnq.cn
http://so8Xe5io.tnLnq.cn
http://RedHfIUS.tnLnq.cn
http://8BtFlrV7.tnLnq.cn
http://YIc2g0ok.tnLnq.cn
http://Ixy4wuXj.tnLnq.cn
http://tf16VDJI.tnLnq.cn
http://BHjH8Chn.tnLnq.cn
http://TxDjbldE.tnLnq.cn
http://mg5DDP5r.tnLnq.cn
http://tFlLfTMZ.tnLnq.cn
http://RKXJxWnD.tnLnq.cn
http://O3331YET.tnLnq.cn
http://i4LJuS1X.tnLnq.cn
http://t8DlBva3.tnLnq.cn
http://Iiofymv6.tnLnq.cn
http://gvzxklBx.tnLnq.cn
http://PFAJUdzH.tnLnq.cn
http://deuLOeng.tnLnq.cn
http://ECE84bBC.tnLnq.cn
http://c3M7zPKu.tnLnq.cn
http://mHcSB0QB.tnLnq.cn
http://ZoDo2hmy.tnLnq.cn
http://Jd05CKVm.tnLnq.cn
http://9kCyP4OF.tnLnq.cn
http://www.dtcms.com/a/209444.html

相关文章:

  • 深度剖析 MCP SDK 最新版:Streamable HTTP 模式
  • 【自定义类型-结构体】--结构体类型,结构体变量的创建和初始化,结构体内存对齐,结构体传参,结构体实现位段
  • 云管理深度解析:资源限额、监控策略与多厂商适配方案
  • C++ 忘掉std::cout吧,fmt和spdlog的结合
  • Python爬虫设置IP代理
  • 无法选择最佳操作符(APP) 目录
  • 电子电路:什么是滤波器,什么优势高通滤波器?
  • Photo Sphere Viewer 的迷你地图插件map-plugin
  • 特殊的完全平方数
  • 常见激活函数
  • 表面遮盖显示需要提取器官吗
  • 通过vue-pdf和print-js实现PDF和图片在线预览
  • Cookie、Session、JWT
  • AUTOSAR图解==>AUTOSAR_SRS_MCUDriver
  • 17、Python对象操作全解析:同一运算符、成员运算符与整数缓存机制实战
  • 论文学习记录之《DiffusionVel》
  • Python+requests实现接口自动化测试
  • Linux中的tty与login之间的关系
  • RHCSA Linux 系统 硬盘管理
  • AI编程对传统软件开发的冲击和思考
  • STM32基本定时器的启动和停止
  • Android中PID与UID的区别和联系
  • vue2 全局指令(输入框自定义限制)
  • 【C++】20. AVL树的实现
  • BU9792驱动段式LCD
  • 解决:dpkg: error: dpkg frontend lock is locked by another process
  • 光伏电站及时巡检:守护清洁能源的“生命线”
  • linux移植lvgl
  • 带您了解工业级网络变压器的浪涌等级测试有哪些条件?
  • Mistral AI 开源最新 Small 模型——Devstral-Small-2505