* @return short value, or 0 if not a short
*/
private static short getShort(Object value) {
- if (value instanceof Short) {
- return ((Short) value).shortValue();
+ if (value instanceof Number) {
+ return ((Number) value).shortValue();
}
return 0;
}
public CellPropertySetter(String propertyName, int value) {
_propertyName = propertyName;
- _propertyValue = Short.valueOf((short) value);
+ _propertyValue = Integer.valueOf(value);
}
public CellPropertySetter(String propertyName, BorderStyle value) {
_propertyName = propertyName;
{
if(_style == null){
SXSSFWorkbook wb = (SXSSFWorkbook)getRow().getSheet().getWorkbook();
- return wb.getCellStyleAt((short)0);
+ return wb.getCellStyleAt(0);
} else {
return _style;
}
if(_font.sizeOfSzArray() == 0) return -1;
CTFontSize sz = _font.getSzArray(0);
- return (short)(20*sz.getVal());
+ return (int)(20*sz.getVal());
}
/**
font1.setColor((short) 20);
Font font2 = wb1.createFont();
font2.setColor(Font.COLOR_RED);
- Font font3 = wb1.getFontAt((short) 0);
+ Font font3 = wb1.getFontAt(0);
XSSFRow row = sheet.createRow(2);
XSSFCell cell = row.createCell(2);
// run some method on the font to verify if it is "disconnected" already
//for(short i = 0;i < 256;i++)
{
- Font font = wb.getFontAt((short) 0);
+ Font font = wb.getFontAt(0);
if (font instanceof XSSFFont) {
- XSSFFont xfont = (XSSFFont) wb.getFontAt((short) 0);
+ XSSFFont xfont = (XSSFFont) wb.getFontAt(0);
CTFontImpl ctFont = (CTFontImpl) xfont.getCTFont();
assertEquals(0, ctFont.sizeOfBArray());
}
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("48779.xlsx");
// Check the CTColor is as expected
- XSSFColor indexed = wb.getCellStyleAt((short)1).getFillBackgroundXSSFColor();
+ XSSFColor indexed = wb.getCellStyleAt(1).getFillBackgroundXSSFColor();
assertEquals(true, indexed.getCTColor().isSetIndexed());
assertEquals(64, indexed.getCTColor().getIndexed());
assertEquals(false, indexed.getCTColor().isSetRgb());
Workbook wb = new XSSFWorkbook();
// cannot check on result because on some machines we get back false here!
- SheetUtil.canComputeColumnWidth(wb.getFontAt((short)0));
+ SheetUtil.canComputeColumnWidth(wb.getFontAt(0));
wb.close();
}
assertEquals(1, wb.getNumberOfFonts());
- XSSFFont f1 = wb.getFontAt((short) 0);
+ XSSFFont f1 = wb.getFontAt(0);
assertFalse(f1.getBold());
// Check that asking for the same font
// multiple times gives you the same thing.
// Otherwise, our tests wouldn't work!
- assertSame(wb.getFontAt((short) 0), wb.getFontAt((short) 0));
+ assertSame(wb.getFontAt(0), wb.getFontAt(0));
assertEquals(
- wb.getFontAt((short) 0),
- wb.getFontAt((short) 0)
+ wb.getFontAt(0),
+ wb.getFontAt(0)
);
// Look for a new font we have
XSSFFont nf = wb.createFont();
assertEquals(2, wb.getNumberOfFonts());
- assertEquals(1, nf.getIndex());
- assertEquals(nf, wb.getFontAt((short) 1));
+ assertEquals(1, nf.getIndexAsInt());
+ assertEquals(nf, wb.getFontAt(1));
nf.setBold(false);
nf.setColor(IndexedColors.INDIGO.getIndex());
nf.setUnderline((byte) 2);
assertEquals(2, wb.getNumberOfFonts());
- assertEquals(nf, wb.getFontAt((short) 1));
+ assertEquals(nf, wb.getFontAt(1));
assertTrue(
- wb.getFontAt((short) 0)
+ wb.getFontAt(0)
!=
- wb.getFontAt((short) 1)
+ wb.getFontAt(1)
);
// Find it now
assertNotNull(font);
assertEquals(
1,
- font.getIndex()
+ font.getIndexAsInt()
);
assertEquals(nf,
wb.findFont(