[fix] 修复excel格式中仅非有效字段列非空的行被判定为非空行,导致解析数据失败的bug

main
walon 2022-12-05 18:04:24 +08:00
parent 9b97f5d0bd
commit 33b7f25fd4
1 changed files with 10 additions and 1 deletions

View File

@ -42,7 +42,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
{
foreach (var row in cells)
{
if (IsBlankRow(row, title.FromIndex, title.ToIndex))
if (IsBlankRow(row, title))
{
continue;
}
@ -188,6 +188,15 @@ namespace Luban.Job.Cfg.DataSources.Excel
return Rows;
}
public static bool IsBlankRow(List<Cell> row, Title title)
{
if (title.SubTitleList.Count == 0)
{
return IsBlankRow(row, title.FromIndex, title.ToIndex);
}
return title.SubTitleList.All(t => IsBlankRow(row, t));
}
public static bool IsBlankRow(List<Cell> row, int fromIndex, int toIndex)
{
for (int i = Math.Max(1, fromIndex), n = Math.Min(toIndex, row.Count - 1); i <= n; i++)