Closed yangliu817 closed 4 years ago
MultipleSheetsListener multipleSheetsListener = new MultipleSheetsListener();
ExcelReader excelReader = EasyExcel.read(file, MultipleSheetsData.class, multipleSheetsListener).build();
List<ReadSheet> sheets = excelReader.excelExecutor().sheetList();
int count = 1;
for (ReadSheet readSheet : sheets) {
excelReader.read(readSheet);
Assert.assertEquals((long)multipleSheetsListener.getList().size(), (long)count);
count++;
}
excelReader.finish();
03版的再读取头的时候会读取整个xls,后续会优化。
`@Override /**
readSheet.getHead(), 获取不到表头 */ public void invoke(Object line, AnalysisContext context) { ReadSheetHolder readSheetHolder = context.readSheetHolder(); ReadSheet readSheet = readSheetHolder.getReadSheet(); List<List> head = readSheet.getHead();