List<Sheet> sheets;
try {
sheets = this.getContents().getSheets().getSheet();
} catch (Docx4JException e1) {
throw new Xlsx4jException(e1.getMessage(), e1);
}
int zeroBasedCount = sheets.size() -1;
if (index< 0 || index>zeroBasedCount) {
throw new Xlsx4jException("No sheet at index " + index + ". (There are " + sheets.size() + " sheets) ");
}
try {
Sheet s = sheets.get(index);
return (WorksheetPart)this.getRelationshipsPart().getPart(s.getId());
} catch (Exception e) {
throw new Xlsx4jException("Sheet " + index + " not found", e);
}
}