Explorar o código

导出表格修改

anderx hai 1 ano
pai
achega
c109559743

+ 10 - 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java

@@ -1894,6 +1894,7 @@ public class ExcelUtil<T>
                 }
             }
             Cell projectDuration = row.createCell(index++);
+
             BigDecimal projectDuration1 = (BigDecimal) stringObjectMap.get("projectDuration");
             projectDuration.setCellValue(projectDuration1.stripTrailingZeros().toPlainString());
             projectDuration.setCellStyle(styles.get("data"));
@@ -1939,7 +1940,7 @@ public class ExcelUtil<T>
         row1.add("姓名");
         row1.add("星期");
         row2.add("姓名");
-        row2.add("日期");
+        row2.add("类型");
         for (Map<String, Object> objectMap : map) {
             row1.add(objectMap.get("week").toString());
             row2.add(objectMap.get("date").toString());
@@ -1953,6 +1954,14 @@ public class ExcelUtil<T>
         sheet.setColumnWidth(row1.size()-2, 14*256);
         sheet.addMergedRegion(new CellRangeAddress(2, 3, 0, 0));
         sheet.addMergedRegion(new CellRangeAddress(2, 3, row1.size()-1, row1.size()-1));
+        for (int index = 2; index < row1.size(); index++){
+            if (index < row1.size()-2){
+                sheet.setColumnWidth(index, 6*256);
+            }else {
+                sheet.setColumnWidth(index, 8*256);
+            }
+
+        }
     }
 
     private void addSubHead(int size, String projectName, String departmentName, String companyName) {