导入修改
This commit is contained in:
@@ -81,6 +81,37 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}
|
||||
|
||||
File.Delete(filePath);
|
||||
|
||||
// 创建一个要删除的行集合
|
||||
var rowsToRemove = new System.Collections.Generic.List<DataRow>();
|
||||
|
||||
// 遍历DataTable的每一行
|
||||
foreach (DataRow row in result.Rows)
|
||||
{
|
||||
bool allEmpty = true;
|
||||
|
||||
// 遍历每一列,检查值
|
||||
foreach (var item in row.ItemArray)
|
||||
{
|
||||
if (item!=null&&!item.ToString().IsNullOrEmpty())
|
||||
{
|
||||
allEmpty = false;
|
||||
break; // 只要有一个不为空,跳出循环
|
||||
}
|
||||
}
|
||||
|
||||
// 如果所有列都是空字符串,则添加到待删除的行集合中
|
||||
if (allEmpty)
|
||||
{
|
||||
rowsToRemove.Add(row);
|
||||
}
|
||||
}
|
||||
|
||||
// 移除标记为待删除的行
|
||||
foreach (var row in rowsToRemove)
|
||||
{
|
||||
result.Rows.Remove(row);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user