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;
}
转载于:https://www.cnblogs.com/lhlong/p/9884275.html
相关资源:Npoi操作Excel设置单元格格式