实用技巧

关注公众号 jb51net

关闭
首页 > 网络编程 > ASP.NET > 实用技巧 > GridView导出Excel文本格式

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

投稿:yourber

本文主要介绍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:@");

您可能感兴趣的文章:
阅读全文