From f08871fe7d148d667f2f11f80f64de71a0d9504c Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期一, 15 六月 2026 18:19:37 +0800
Subject: [PATCH] 优化标准老化界面

---
 HMI.Util/ExcelHelper.cs |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/HMI.Util/ExcelHelper.cs b/HMI.Util/ExcelHelper.cs
index 0708a5c..801b657 100644
--- a/HMI.Util/ExcelHelper.cs
+++ b/HMI.Util/ExcelHelper.cs
@@ -104,6 +104,36 @@
             }
         }
 
+        public static void ExportExcel(string targetPath, List<string[]> rows)
+        {
+            IWorkbook workbook = null;
+            if (targetPath.EndsWith(".xlsx"))
+            {
+                workbook = new XSSFWorkbook();
+            }
+            else if (targetPath.EndsWith(".xls"))
+            {
+                workbook = new HSSFWorkbook();
+            }
+            workbook.CreateSheet("sheet1");////鏂板缓涓�涓伐浣滆〃
+            ISheet SheetOne = workbook.GetSheet("sheet1");
+
+
+            for (int i = 0; i < rows.Count; i++)
+            {
+                IRow rowTemp = SheetOne.CreateRow(i);
+                for (int j = 0; j < rows[i].Length; j++)
+                {
+                    rowTemp.CreateCell(j).SetCellValue(rows[i][j]);
+                }
+            }
+
+            using (FileStream fs = new FileStream(targetPath, FileMode.OpenOrCreate))
+            {
+                workbook.Write(fs);
+            }
+        }
+
 
         public static List<T> ReadFromExcel<T>(string sourcePath)
         {

--
Gitblit v1.9.1