| | |
| | | //获取最后一行的num,即总行数。此处从0开始 |
| | | int maxRow = sheet.getLastRowNum(); |
| | | for (int row = 0; row <= maxRow; row++) { |
| | | int maxRol = sheet.getRow(row).getLastCellNum(); |
| | | StringBuilder aLine = new StringBuilder(); |
| | | for (int rol = 0; rol < maxRol; rol++) { |
| | | aLine.append(sheet.getRow(row).getCell(rol)).append(splitIdentifier); |
| | | if(Objects.nonNull(sheet.getRow(row))){ |
| | | int maxRol = sheet.getRow(row).getLastCellNum(); |
| | | StringBuilder aLine = new StringBuilder(); |
| | | for (int rol = 0; rol < maxRol; rol++) { |
| | | aLine.append(sheet.getRow(row).getCell(rol)).append(splitIdentifier); |
| | | } |
| | | result.append(aLine).append("\n"); |
| | | } |
| | | result.append(aLine).append("\n"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |