diff --git a/njcn-springboot/spingboot2.3.12/src/main/java/com/njcn/web/utils/ExcelUtil.java b/njcn-springboot/spingboot2.3.12/src/main/java/com/njcn/web/utils/ExcelUtil.java index 01156ed..eab4c69 100644 --- a/njcn-springboot/spingboot2.3.12/src/main/java/com/njcn/web/utils/ExcelUtil.java +++ b/njcn-springboot/spingboot2.3.12/src/main/java/com/njcn/web/utils/ExcelUtil.java @@ -121,7 +121,7 @@ public class ExcelUtil { * * @param fileName 文件名 */ - public static void exportExcelPullDown(ExportParams exportParams, String fileName, List pullDowns, Class pojoClass, Collection dataSet) { + public static void exportExcelPullDown(ExportParams exportParams, String fileName, int headerRowNumber, List pullDowns, Class pojoClass, Collection dataSet) { HttpServletResponse response = HttpServletUtil.getResponse(); try (ServletOutputStream outputStream = response.getOutputStream()) { fileName = URLEncoder.encode(fileName, CharsetUtil.UTF_8); @@ -155,10 +155,10 @@ public class ExcelUtil { } } Sheet sheetAt = workbook.getSheetAt(0); - //获取列数 - int physicalNumberOfCells = sheetAt.getRow(0).getPhysicalNumberOfCells(); //没有表格标题,只有表格头 - for (int i = 0; i < 1; i++) { + for (int i = 0; i < headerRowNumber; i++) { + //获取列数 + int physicalNumberOfCells = sheetAt.getRow(i).getPhysicalNumberOfCells(); //获取行 Row row = sheetAt.getRow(i); if (Objects.isNull(row)) {