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
@@ -54,7 +54,7 @@ uploadArchives { | @@ -54,7 +54,7 @@ uploadArchives { | ||
54 | authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) | 54 | authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) |
55 | } | 55 | } |
56 | pom.project { | 56 | pom.project { |
57 | - version '2.2.24' | 57 | + version '2.2.26' |
58 | artifactId ARTIFACT_Id | 58 | artifactId ARTIFACT_Id |
59 | groupId GROUP_ID | 59 | groupId GROUP_ID |
60 | packaging TYPE | 60 | packaging TYPE |
src/main/java/com/taover/easyexcel/analysis/v07/XlsxSaxAnalyser.java
@@ -287,7 +287,12 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor { | @@ -287,7 +287,12 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor { | ||
287 | } | 287 | } |
288 | } | 288 | } |
289 | if(result.isEmpty()) { | 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 | return result; | 297 | return result; |
293 | } | 298 | } |
src/test/java/com/taover/easyexcel/test/WbTest.java
@@ -14,7 +14,8 @@ public class WbTest { | @@ -14,7 +14,8 @@ public class WbTest { | ||
14 | //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\Excel隐藏行\\配送确认1.16(1).xlsx"); | 14 | //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\Excel隐藏行\\配送确认1.16(1).xlsx"); |
15 | //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\Excel隐藏行\\吉祥三宝-20210128-29条(1).xlsx"); | 15 | //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\Excel隐藏行\\吉祥三宝-20210128-29条(1).xlsx"); |
16 | //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\读入错误\\数值读入错误.xlsx"); | 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 | //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\表头匹配-测试文件\\多sheet-多个可用-数据有无.xlsx"); | 19 | //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\表头匹配-测试文件\\多sheet-多个可用-数据有无.xlsx"); |
19 | List<List<Object>> data = transListMapTo2List(EasyExcel.read(dataFile).readHiddenRow(false).headRowNumber(0).doReadSelectedSync()); | 20 | List<List<Object>> data = transListMapTo2List(EasyExcel.read(dataFile).readHiddenRow(false).headRowNumber(0).doReadSelectedSync()); |
20 | for(List<Object> row: data) { | 21 | for(List<Object> row: data) { |