首页 > 编程 > .NET > 正文

GridView导出Excel常见的5种文本格式

2024-07-10 13:30:02
字体:
来源:转载
供稿:网友
本文主要介绍GridView导出Excel常见的文本格式,以帮助开发人员做导出的Excel时避免出现文本格式不一致的问题。
 

1) 文本:vnd.ms-excel.numberformat:@

2) 日期:vnd.ms-excel.numberformat:yyyy/mm/dd

3) 数字:vnd.ms-excel.numberformat:#,##0.00

4) 货币:vnd.ms-excel.numberformat:¥#,##0.00

5) 百分比:vnd.ms-excel.numberformat: #0.00%

用法:在GridView的RowDataBound事件中加入代码e.Row.Cells[0].Attributes.Add("style", "vnd.ms-excel.numberformat:@");



发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表