可以使用这个类来实现此功能:

将DataGrid导出为Excel文件using System.IO;
将DataGrid导出为Excel文件
using System.Text;
将DataGrid导出为Excel文件
using System.Web;
将DataGrid导出为Excel文件
using System.Web.UI;
将DataGrid导出为Excel文件
将DataGrid导出为Excel文件
namespace Jeky.Web
}

另外,如果DataGrid中存在较长的数字值,例如“身份证”字段时,导出的Excel可能会以下格式出现:4.11303E+14,解决方法:

将DataGrid导出为Excel文件// 在 DataBound 事件中处理
将DataGrid导出为Excel文件
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 
 

相关文章:

  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2021-10-18
  • 2021-07-05
  • 2022-12-23
猜你喜欢
  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
相关资源
相似解决方案