Commit ea4e20eaac2dd74ac19d019c10ef08b712e715e6
1 parent
35ef3894
Exists in
master
some debug code
Showing
3 changed files
with
31 additions
and
8 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.16' | 57 | + version '2.2.16.debug' |
| 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
| 1 | package com.taover.easyexcel.analysis.v07; | 1 | package com.taover.easyexcel.analysis.v07; |
| 2 | 2 | ||
| 3 | +import java.io.BufferedInputStream; | ||
| 3 | import java.io.File; | 4 | import java.io.File; |
| 4 | import java.io.IOException; | 5 | import java.io.IOException; |
| 5 | import java.io.InputStream; | 6 | import java.io.InputStream; |
| @@ -172,6 +173,7 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor { | @@ -172,6 +173,7 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor { | ||
| 172 | 173 | ||
| 173 | private void parseXmlSource(InputStream inputStream, ContentHandler handler) { | 174 | private void parseXmlSource(InputStream inputStream, ContentHandler handler) { |
| 174 | InputSource inputSource = new InputSource(inputStream); | 175 | InputSource inputSource = new InputSource(inputStream); |
| 176 | + //this.printInputSource(inputSource); | ||
| 175 | try { | 177 | try { |
| 176 | SAXParserFactory saxFactory; | 178 | SAXParserFactory saxFactory; |
| 177 | String xlsxSAXParserFactoryName = xlsxReadContext.xlsxReadWorkbookHolder().getSaxParserFactoryName(); | 179 | String xlsxSAXParserFactoryName = xlsxReadContext.xlsxReadWorkbookHolder().getSaxParserFactoryName(); |
| @@ -206,6 +208,24 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor { | @@ -206,6 +208,24 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor { | ||
| 206 | } | 208 | } |
| 207 | } | 209 | } |
| 208 | } | 210 | } |
| 211 | + | ||
| 212 | + private void printInputSource(InputSource inputSource) { | ||
| 213 | + BufferedInputStream bis = new BufferedInputStream(inputSource.getByteStream()); | ||
| 214 | + byte[] buffer = new byte[1000*1024]; | ||
| 215 | + try { | ||
| 216 | + int len = bis.read(buffer); | ||
| 217 | + String data = new String(buffer, 0, len); | ||
| 218 | + System.out.println(data); | ||
| 219 | + bis.close(); | ||
| 220 | + } catch (IOException e1) { | ||
| 221 | + try { | ||
| 222 | + bis.close(); | ||
| 223 | + } catch (IOException e) { | ||
| 224 | + e.printStackTrace(); | ||
| 225 | + } | ||
| 226 | + e1.printStackTrace(); | ||
| 227 | + } | ||
| 228 | + } | ||
| 209 | 229 | ||
| 210 | @Override | 230 | @Override |
| 211 | public void execute() { | 231 | public void execute() { |
src/test/java/com/taover/easyexcel/test/WbTest.java
| @@ -11,13 +11,16 @@ import com.taover.easyexcel.EasyExcel; | @@ -11,13 +11,16 @@ import com.taover.easyexcel.EasyExcel; | ||
| 11 | public class WbTest { | 11 | public class WbTest { |
| 12 | public static void main(String[] args) { | 12 | public static void main(String[] args) { |
| 13 | File dataFile = new File("C:\\Users\\Administrator\\Desktop\\Excel隐藏行\\配送确认1.16(1).xlsx"); | 13 | File dataFile = new File("C:\\Users\\Administrator\\Desktop\\Excel隐藏行\\配送确认1.16(1).xlsx"); |
| 14 | - List<List<Object>> data = transListMapTo2List(EasyExcel.read(dataFile).readHiddenRow(false).headRowNumber(0).doReadSelectedSync()); | ||
| 15 | - for(List<Object> row: data) { | ||
| 16 | - for(Object item: row) { | ||
| 17 | - System.out.print(item+":"); | ||
| 18 | - } | ||
| 19 | - System.out.println(); | ||
| 20 | - } | 14 | +// List<List<Object>> data = transListMapTo2List(EasyExcel.read(dataFile).readHiddenRow(false).headRowNumber(0).doReadSelectedSync()); |
| 15 | +// for(List<Object> row: data) { | ||
| 16 | +// for(Object item: row) { | ||
| 17 | +// System.out.print(item+":"); | ||
| 18 | +// } | ||
| 19 | +// System.out.println(); | ||
| 20 | +// } | ||
| 21 | + | ||
| 22 | + Map<Integer, List<Map<Integer, Object>>> data2 = EasyExcel.read(dataFile).readHiddenRow(false).headRowNumber(0).doReadAllSyncForMap(); | ||
| 23 | + System.out.println(data2.get(0).size()); | ||
| 21 | } | 24 | } |
| 22 | 25 | ||
| 23 | private static List<List<Object>> transListMapTo2List(List<Object> listMapData) { | 26 | private static List<List<Object>> transListMapTo2List(List<Object> listMapData) { |