private void openSheet() { final Sheet sheet = this.getSheet(this.currentSheet); this.rs =rowSetFactory.create(sheet); if (logger.isDebugEnabled()) { logger.debug("Opening sheet " + sheet.getName() + "."); } for (int i = 0; i < this.linesToSkip; i++) { if (rs.next() && this.skippedRowsCallback != null) { this.skippedRowsCallback.handleRow(rs); } } if (logger.isDebugEnabled()) { logger.debug("Openend sheet " + sheet.getName() + ", with " + sheet.getNumberOfRows() + " rows."); } }
/** * @return string corresponding to logical record according to * {@link #setRowMapper(RowMapper)} (might span multiple rows in file). */ @Override protected T doRead() throws Exception { if (this.noInput || this.rs == null) { return null; } if (rs.next()) { try { return this.rowMapper.mapRow(rs); } catch (final Exception e) { throw new ExcelFileParseException("Exception parsing Excel file.", e, this.resource.getDescription(), rs.getMetaData().getSheetName(), rs.getCurrentRowIndex(), rs.getCurrentRow()); } } else { this.currentSheet++; if (this.currentSheet >= this.getNumberOfSheets()) { if (logger.isDebugEnabled()) { logger.debug("No more sheets in '" + this.resource.getDescription() + "'."); } return null; } else { this.openSheet(); return this.doRead(); } } }