C# npoi判断excel具体行数

仅对有必填行数有有效

 

 

int countCol=0
// i为一定不为空的列
            for (int i = 0; i <= headerRow.LastCellNum; i++)
            {
                if (sheet.GetRow(1).GetCell(i) == null)
                {
                    break;
                }

                if (string.IsNullOrEmpty(sheet.GetRow(1).GetCell(i).ToString()))
                {
                    break;
                }

                countCol = i;
            }

 

posted @ 2021-11-11 14:51  大脑过载  阅读(628)  评论(0)    收藏  举报