This commit is contained in:
caozehui
2025-02-19 08:43:33 +08:00
parent 52ecfe0d49
commit aa97bec67b

View File

@@ -121,7 +121,7 @@ public class ExcelUtil {
*
* @param fileName 文件名
*/
public static void exportExcelPullDown(ExportParams exportParams, String fileName, List<PullDown> pullDowns, Class<?> pojoClass, Collection<?> dataSet) {
public static void exportExcelPullDown(ExportParams exportParams, String fileName, int headerRowNumber, List<PullDown> 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)) {