[fix] 修复excel格式中仅非有效字段列非空的行被判定为非空行,导致解析数据失败的bug
parent
9b97f5d0bd
commit
33b7f25fd4
|
|
@ -42,7 +42,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
||||||
{
|
{
|
||||||
foreach (var row in cells)
|
foreach (var row in cells)
|
||||||
{
|
{
|
||||||
if (IsBlankRow(row, title.FromIndex, title.ToIndex))
|
if (IsBlankRow(row, title))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -188,6 +188,15 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
||||||
return Rows;
|
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)
|
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++)
|
for (int i = Math.Max(1, fromIndex), n = Math.Min(toIndex, row.Count - 1); i <= n; i++)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue