diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusTestServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusTestServiceImpl.java index da6367e7..064c63e8 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusTestServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusTestServiceImpl.java @@ -387,7 +387,7 @@ public class BusTestServiceImpl { } /** - * 施工进度统计表(第11-18行)- 修正表头合并和内容 + * 施工进度统计表(第11-18行)- 修正J,K列逐行合并 */ private static void createConstructionProgressTable(Sheet sheet, Workbook workbook, int startRow, CellStyle headerStyle, CellStyle contentStyle, @@ -452,6 +452,11 @@ public class BusTestServiceImpl { cell.setCellValue(progressData[i][j]); cell.setCellStyle(contentStyle); } + + // 每行的J,K列单独合并 + Cell jkCell = row.createCell(9); // J列 + jkCell.setCellStyle(contentStyle); + addMergedRegionSafe(sheet, startRow + 1 + i, startRow + 1 + i, 9, 10); } // 设置合并区域 @@ -466,14 +471,14 @@ public class BusTestServiceImpl { sheet.addMergedRegion(new CellRangeAddress(startRow + 5, startRow + 7, 3, 3)); // L12:L18合并(备注) sheet.addMergedRegion(new CellRangeAddress(startRow + 1, startRow + 7, 11, 11)); - // 注意:取消了J12:K18的合并,现在J,K列在数据行是分开的 + // 注意:移除了J12:K18的整体合并,改为逐行合并 } catch (IllegalStateException e) { System.err.println("施工进度表合并区域设置失败: " + e.getMessage()); } } /** - * 设备材料表格(第19-23行)- 修正表头合并和内容 + * 设备材料表格(第19-23行)- 修正J,K列逐行合并 */ private static void createEquipmentMaterialTable(Sheet sheet, Workbook workbook, int startRow, CellStyle headerStyle, CellStyle contentStyle, @@ -535,6 +540,11 @@ public class BusTestServiceImpl { cell.setCellValue(materialData[i][j]); cell.setCellStyle(contentStyle); } + + // 每行的J,K列单独合并 + Cell jkCell = row.createCell(9); // J列 + jkCell.setCellStyle(contentStyle); + addMergedRegionSafe(sheet, startRow + 1 + i, startRow + 1 + i, 9, 10); } // 设置合并区域 @@ -545,7 +555,7 @@ public class BusTestServiceImpl { sheet.addMergedRegion(new CellRangeAddress(startRow, startRow + 4, 1, 1)); // L20:L23合并(备注) sheet.addMergedRegion(new CellRangeAddress(startRow + 1, startRow + 4, 11, 11)); - // 注意:取消了J20:K23的合并,现在J,K列在数据行是分开的 + // 注意:移除了J20:K23的整体合并,改为逐行合并 } catch (IllegalStateException e) { System.err.println("设备材料表合并区域设置失败: " + e.getMessage()); } @@ -803,9 +813,10 @@ public class BusTestServiceImpl { // 按从小到大的顺序设置合并区域 try { - // 1. 最小的合并区域先设置 - sheet.addMergedRegion(new CellRangeAddress(2, 3, 9, 11)); // K3:L4合并 - System.out.println("设置小合并区域: K3:L4"); + // 1. 取消J3:J4和K3:L4合并,改为单独的合并区域 + sheet.addMergedRegion(new CellRangeAddress(2, 3, 9, 9)); // J3:J4合并 + sheet.addMergedRegion(new CellRangeAddress(2, 3, 10, 11)); // K3:L4合并 + System.out.println("设置小合并区域: J3:J4, K3:L4"); // 2. 中等范围的合并区域 sheet.addMergedRegion(new CellRangeAddress(2, 2, 0, 1)); // A3:B3