IRow row = sheet.GetRow(i);
坑:如果此行存在空的cell,则row.Cells[index] 不能获取到,空的单元格不能生成cells
/// <summary> /// 获取这一列的某个Cell /// </summary> /// <param name="Row"></param> /// <param name="index"></param> /// <returns></returns> public ICell GetCell(IRow Row, int index) { ICell cell = Row.FirstOrDefault(n => n.ColumnIndex == index); if (cell == null) { cell = Row.CreateCell(index); } return cell; }