转自:http://www.cnblogs.com/leonny/,作者:leonny.
优化前的代码, 从DataTable导入1000笔数据要差不多10分钟,有时候还会超时或出错:
优化后的代码, 从DataTable导入60000(注意,是六万)笔数据, 只要不到两分钟.
1
public void WriteDataToSpreadsheet(SpreadsheetClass p_spreadsheet, DataTable p_dt,
2
int p_iRow, int p_iCol, bool p_bWithCaption, int p_iStaredRecord,
3
int p_iLimited, int[] p_iTextColumns)
4
2
3
4
上面一些代码是有其他用的, 大家只要看注释那块的就行了. 人太懒, 不好意思. 呵呵.
这个方法只是我在项目中使用的代码, 时间比较紧, 肯定还有更快的方法, 如果各位有更好的方法, 请赐教.