private String styleName(CellStyle style) {
if (style == null) {
- style = wb.getCellStyleAt((short) 0);
+ style = wb.getCellStyleAt(0);
}
StringBuilder sb = new StringBuilder();
try (Formatter fmt = new Formatter(sb, Locale.ROOT)) {
@Override
public CellStyle getColumnStyle(int column) {
int idx = columnHelper.getColDefaultStyle(column);
- return getWorkbook().getCellStyleAt((short)(idx == -1 ? 0 : idx));
+ return getWorkbook().getCellStyleAt(idx == -1 ? 0 : idx);
}
/**
try (XSSFWorkbook wb = new XSSFWorkbook()) {
XSSFSheet s = wb.createSheet();
- CellStyle defaultStyle = wb.getCellStyleAt((short) 0);
+ CellStyle defaultStyle = wb.getCellStyleAt(0);
assertEquals(0, defaultStyle.getIndex());
CellStyle blueStyle = wb.createCellStyle();
assertEquals(1, wb.getNumCellStyles());
assertEquals(2, styles.getFills().size());
- XSSFCellStyle defaultStyle = wb.getCellStyleAt((short)0);
+ XSSFCellStyle defaultStyle = wb.getCellStyleAt(0);
assertEquals(IndexedColors.AUTOMATIC.getIndex(), defaultStyle.getFillForegroundColor());
assertNull(defaultStyle.getFillForegroundXSSFColor());
assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPattern());
// Write out and read back
try (HSSFWorkbook wb2 = writeOutAndReadBack(wb1)) {
// Re-check
- assertEquals("Testing", wb2.getCellStyleAt((short) 21).getUserStyleName());
- assertEquals("Testing 2", wb2.getCellStyleAt((short) 22).getUserStyleName());
- assertEquals("Testing 3", wb2.getCellStyleAt((short) 23).getUserStyleName());
+ assertEquals("Testing", wb2.getCellStyleAt(21).getUserStyleName());
+ assertEquals("Testing 2", wb2.getCellStyleAt(22).getUserStyleName());
+ assertEquals("Testing 3", wb2.getCellStyleAt(23).getUserStyleName());
}
}
}
Cell cell = row.createCell(0);
// different default style indexes for HSSF and XSSF/SXSSF
- CellStyle defaultStyle = wb.getCellStyleAt(wb instanceof HSSFWorkbook ? (short) 15 : (short) 0);
+ CellStyle defaultStyle = wb.getCellStyleAt(wb instanceof HSSFWorkbook ? 15 : 0);
// Starts out with the default style
assertEquals(defaultStyle, cell.getCellStyle());