原因: 在Excel中对整行执行“清空数据”的操作时就会造成这个现象,“删除”整行则不会。
解决:增加行的判断
if(cell !=null && cell.CellType != CellType.Blank && string.IsNullOrEmpyt(cell.ToString().Trim()))
// 举例
//循环此行中的列内容
foreach (ICell cell in sheet.GetRow(i))
{
//判断列值为空则累计空值数量
if (cell == null || cell.CellType == CellType.Blank || string.IsNullOrEmpty(cell.ToString().Trim()))
}