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
src/main/java/com/taover/easyexcel/analysis/v07/XlsxSaxAnalyser.java
| 1 | 1 | package com.taover.easyexcel.analysis.v07; |
| 2 | 2 | |
| 3 | +import java.io.BufferedInputStream; | |
| 3 | 4 | import java.io.File; |
| 4 | 5 | import java.io.IOException; |
| 5 | 6 | import java.io.InputStream; |
| ... | ... | @@ -172,6 +173,7 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor { |
| 172 | 173 | |
| 173 | 174 | private void parseXmlSource(InputStream inputStream, ContentHandler handler) { |
| 174 | 175 | InputSource inputSource = new InputSource(inputStream); |
| 176 | + //this.printInputSource(inputSource); | |
| 175 | 177 | try { |
| 176 | 178 | SAXParserFactory saxFactory; |
| 177 | 179 | String xlsxSAXParserFactoryName = xlsxReadContext.xlsxReadWorkbookHolder().getSaxParserFactoryName(); |
| ... | ... | @@ -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 | 230 | @Override |
| 211 | 231 | public void execute() { | ... | ... |
src/test/java/com/taover/easyexcel/test/WbTest.java
| ... | ... | @@ -11,13 +11,16 @@ import com.taover.easyexcel.EasyExcel; |
| 11 | 11 | public class WbTest { |
| 12 | 12 | public static void main(String[] args) { |
| 13 | 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 | 26 | private static List<List<Object>> transListMapTo2List(List<Object> listMapData) { | ... | ... |