我在我的 .net core web api 中使用 EPPlus 库。在上述方法中,我想验证他上传的 excel。我想知道我的整行是否为空。我有以下代码:
using (ExcelPackage package = new ExcelPackage(file.OpenReadStream()))
{
ExcelWorksheet worksheet = package.Workbook.Worksheets[1];
int rowCount = worksheet.Dimension.End.Row;
int colCount = worksheet.Dimension.End.Column;
//loop through rows and columns
for (int row = 1; row <= rowCount; row++)
{
for (int col = 1; col <= ColCount; col++)
{
var rowValue = worksheet.Cells[row, col].Value;
//Want to find here if the entire row is empty
}
}
}
如果特定单元格为空,上面的 rowValue 会给我。是否可以检查整行并在为空时继续下一行。
繁星淼淼
芜湖不芜
蝴蝶不菲
相关分类