From 99df058a665ea04065a23e729ec79a2f23f79881 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期二, 20 五月 2025 16:59:43 +0800
Subject: [PATCH] 优化
---
HMI.Util/ExcelHelper.cs | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/HMI.Util/ExcelHelper.cs b/HMI.Util/ExcelHelper.cs
index b2ee156..ee8f3fc 100644
--- a/HMI.Util/ExcelHelper.cs
+++ b/HMI.Util/ExcelHelper.cs
@@ -43,7 +43,8 @@
IRow rowTemp = SheetOne.CreateRow(i + 1);
for (int j = 0; j < properties.Count; j++)
{
- var value = properties[j].GetValue(datas[i]);
+ var attr = attrs[j];
+ var value = attr.IgnoreExport ? "" : properties[j].GetValue(datas[i]);
rowTemp.CreateCell(j).SetCellValue(value.ToString());
}
}
@@ -97,7 +98,10 @@
string title = titleRow.GetCell(j).StringCellValue;
if (dict.ContainsKey(title))
{
- CellType ct = row.GetCell(j).CellType;
+ var cell = row.GetCell(j);
+ if (cell == null || cell.CellType == CellType.Blank)
+ continue;
+ CellType ct = cell.CellType;
object value = null;
if (ct == CellType.String)
value = row.GetCell(j).StringCellValue;
--
Gitblit v1.9.1