Commit 7334b8d6a62fe0541a299260c12715717a239120
1 parent
a77254d3
Exists in
master
1.fix a bug when not select any sheet except hidden
Showing
3 changed files
with
9 additions
and
3 deletions
Show diff stats
build.gradle
src/main/java/com/taover/easyexcel/analysis/v07/XlsxSaxAnalyser.java
... | ... | @@ -287,7 +287,12 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor { |
287 | 287 | } |
288 | 288 | } |
289 | 289 | if(result.isEmpty()) { |
290 | - result.add(sheetData.get(0)); | |
290 | + for(ReadSheet item: sheetData) { | |
291 | + if(!item.getSheetHidden()) { | |
292 | + result.add(item); | |
293 | + break; | |
294 | + } | |
295 | + } | |
291 | 296 | } |
292 | 297 | return result; |
293 | 298 | } | ... | ... |
src/test/java/com/taover/easyexcel/test/WbTest.java
... | ... | @@ -14,7 +14,8 @@ public class WbTest { |
14 | 14 | //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\Excel隐藏行\\配送确认1.16(1).xlsx"); |
15 | 15 | //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\Excel隐藏行\\吉祥三宝-20210128-29条(1).xlsx"); |
16 | 16 | //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\读入错误\\数值读入错误.xlsx"); |
17 | - File dataFile = new File("C:\\Users\\Administrator\\Desktop\\读入错误\\数值读入错误-测试.xlsx"); | |
17 | +// File dataFile = new File("C:\\Users\\Administrator\\Desktop\\读入错误\\数值读入错误-测试.xlsx"); | |
18 | + File dataFile = new File("C:\\Users\\Administrator\\Desktop\\郑丽丽加单.xlsx"); | |
18 | 19 | //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\表头匹配-测试文件\\多sheet-多个可用-数据有无.xlsx"); |
19 | 20 | List<List<Object>> data = transListMapTo2List(EasyExcel.read(dataFile).readHiddenRow(false).headRowNumber(0).doReadSelectedSync()); |
20 | 21 | for(List<Object> row: data) { | ... | ... |