protected abstract Workbook getWorkbook(final InputStream inputStream) throws IOException;
@Override
public SpreadsheetDocument read(final InputStream inputStream) throws IOException {
SpreadsheetDocument document = new SpreadsheetDocument();
Workbook workbook = this.getWorkbook(inputStream);
int numSheets = workbook.getNumberOfSheets();
for (int sheetIndex = 0; sheetIndex < numSheets; sheetIndex++) {
org.apache.poi.ss.usermodel.Sheet sheet = workbook.getSheetAt(sheetIndex);
Sheet s = new Sheet(sheet.getSheetName());
if (sheet.getPhysicalNumberOfRows() > 0) {
int numRows = sheet.getLastRowNum();
for (int rowIndex = 0; rowIndex <= numRows; rowIndex++) {
org.apache.poi.ss.usermodel.Row row = sheet.getRow(rowIndex);
this.handleRow(s, row);
}
document.getSheets().add(s);
}
}
return document;
}