diff --git a/backend/src/main/java/com/yfd/platform/utils/ExportZipUtil.java b/backend/src/main/java/com/yfd/platform/utils/ExportZipUtil.java index 6670a6af..b11940e8 100644 --- a/backend/src/main/java/com/yfd/platform/utils/ExportZipUtil.java +++ b/backend/src/main/java/com/yfd/platform/utils/ExportZipUtil.java @@ -486,10 +486,10 @@ public class ExportZipUtil { // ---- 自动调整列宽 ---- autoSizeColumns(sheet, colCount); - // 冻结表头行 + // 冻结表头行(含多层表头:headerRowCount 表示除首行外的子表头,总冻结行数 = 1 + headerRowCount) if (currentRow > 1) { - int freezeRows = 1 + sheetData.getHeaderRowCount(); - sheet.createFreezePane(0, Math.min(freezeRows, currentRow - 1)); + int freezeRows = Math.min(1 + sheetData.getHeaderRowCount(), currentRow); + sheet.createFreezePane(0, freezeRows); } }