Browse Source

fix:单元格超出最大范围

ly 11 months ago
parent
commit
024c8f03bd
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/main/java/cn/ezhizao/common/utils/poi/ExcelUtil.java

+ 6 - 1
src/main/java/cn/ezhizao/common/utils/poi/ExcelUtil.java

@@ -913,7 +913,12 @@ public class ExcelUtil<T>
                     }
                 }
             }
-            sheet.setColumnWidth(columnNum, columnWidth * 256);
+            if(30 * 256 * 3 > columnWidth * 256){
+                sheet.setColumnWidth(columnNum, columnWidth * 256);
+            }else{
+                sheet.setColumnWidth(columnNum, 30 * 256 * 3);
+            }
+
         }
     }