相关网址:http://www.cnblogs.com/luxiaoxun/p/3374992.html
方法1:http://www.cnblogs.com/luxiaoxun/p/3374992.html
封装重写; list 导入数据方法:
/// <summary>
/// 将List数据导入到excel中
/// </summary>
/// <param name="data">要导入的数据</param>
/// <param name="isColumnWritten">DataTable的列名是否要导入</param>
/// <param name="sheetName">要导入的excel的sheet的名称</param>
/// <param name="cols">列名集合</param>
/// <returns>导入数据行数(包含列名那一行)</returns>
public int ListToExcel<T>(List<T> data, string sheetName, string[] cols, bool isColumnWritten)
{
int i = 0;
int j = 0;
int count = 0;
ISheet sheet = null;
fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
if (fileName.IndexOf(".xlsx") > 0) // 2007版本
workbook = new XSSFWorkbook();
else if (fileName.IndexOf(".xls") > 0) // 2003版本
workbook = new HSSFWorkbook();
try
{
if (workbook != null)