Forráskód Böngészése

后管-excel-上传
1、对隐藏行设置默认行高0.1

LHB 1 hónapja
szülő
commit
593c902c20

+ 10 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/ExcelInfoUtils.java

@@ -1,8 +1,6 @@
 package org.springblade.manager.utils;
 
-import com.aspose.cells.Column;
-import com.aspose.cells.ColumnCollection;
-import com.aspose.cells.SaveFormat;
+import com.aspose.cells.*;
 import com.spire.xls.CellRange;
 import com.spire.xls.FileFormat;
 import com.spire.xls.Workbook;
@@ -232,6 +230,15 @@ public class ExcelInfoUtils {
                 column.setWidth(0.1);
             }
         }
+        // 处理隐藏行
+        RowCollection rows = worksheet.getCells().getRows();
+        for (int i = 0; i < rows.getCount(); i++) {
+            Row row = rows.get(i);
+            if (row.isHidden()) {
+                row.setHidden(false);
+                row.setHeight(0.1);
+            }
+        }
         // 将工作簿保存到ByteArrayOutputStream,然后转换为ByteArrayInputStream
         ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
         workbook.save(outputStream, SaveFormat.XLSX);