apache / apache/fesod

运行报错:java.lang.IllegalArgumentException: Invalid cell range, having lastRow < firstRow || lastCol < firstCol, had rows -1 >= -1 or cells 0 >= 16383

Open
#331 7 comments 0 reactions 0 assignees View on GitHub
help wanted question
Dominant language
Java
Stars
6.2k
Forks
532
Avg merge
1d 3h
Merged PRs (30d)
42

Description

我根据报错的位置坐了debug,截图如下:

![Image](https://github.com/user-attachments/assets/4693428b-c7c2-44e2-a211-50740a439f8b)

public static void main(String[] args) {
String template = "C:\\Users\\jp\\Desktop\\demo2.xlsx";
String fileName = "C:\\Users\\jp\\Desktop\\aaa.xlsx";
Map m = new HashMap<>();
m.put("no", "123");
m.put("name", "456");
List> list = new ArrayList<>();
list.add(m);
try (ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(template).build()) {
WriteSheet writeSheet = EasyExcel.writerSheet().build();
FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build();
// 如果有多个list 模板上必须有{前缀.} 这里的前缀就是 data1,然后多个list必须用 FillWrapper包裹
excelWriter.fill(new FillWrapper("data1", list), fillConfig, writeSheet);
Map map = new HashMap();
map.put("date", new Date());
map.put("no", "1234566");
excelWriter.fill(map, writeSheet);
}
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.