POI解析Excel【poi的坑——空行处理】
List<List<String>> result = new ArrayList<List<String>>(); InputStream is = file.getInputStream(); Workbook book = new HSSFWorkbook(is); Sheet sheet = book.getSheetAt(0); // 遍历行 Row row = null; int rowCnt = 0; while((row = sheet.getRow(rowCnt++)) != null){ List<String> rowData = new ArrayList<String>(); int colCnt = 0; Cell cell = null; while((cell = row.getCell(colCnt++)) != null){ // 获取单元格的值 String data = getCellValue(cell); if(filter != null){ data = filter.filter(rowCnt, colCnt, data, cell); } rowData.add(data); } result.add(rowData); } List<List<String>> result = new ArrayList<List<String