FontRecord fr = _workbook.createNewFont();
fr.cloneStyleFrom(
source._workbook.getFontRecordAt(
- source.getFontIndex()
+ source.getFontIntIndex()
)
);
put(properties, FILL_PATTERN, style.getFillPattern());
put(properties, FILL_FOREGROUND_COLOR, style.getFillForegroundColor());
put(properties, FILL_BACKGROUND_COLOR, style.getFillBackgroundColor());
- put(properties, FONT, style.getFontIndex());
+ put(properties, FONT, style.getFontIntIndex());
put(properties, HIDDEN, style.getHidden());
put(properties, INDENTION, style.getIndention());
put(properties, LEFT_BORDER_COLOR, style.getLeftBorderColor());
private static void assumeRequiredFontsAreInstalled(final Workbook workbook, final Cell cell) {
// autoSize will fail if required fonts are not installed, skip this test then
- Font font = workbook.getFontAt(cell.getCellStyle().getFontIndex());
+ Font font = workbook.getFontAt(cell.getCellStyle().getFontIntIndex());
Assume.assumeTrue("Cannot verify autoSizeColumn() because the necessary Fonts are not installed on this machine: " + font,
SheetUtil.canComputeColumnWidth(font));
}
private static void assumeRequiredFontsAreInstalled(final Workbook workbook, final Cell cell) {
// autoSize will fail if required fonts are not installed, skip this test then
- Font font = workbook.getFontAt(cell.getCellStyle().getFontIndex());
+ Font font = workbook.getFontAt(cell.getCellStyle().getFontIntIndex());
Assume.assumeTrue("Cannot verify autoSizeColumn() because the necessary Fonts are not installed on this machine: " + font,
SheetUtil.canComputeColumnWidth(font));
}
cellXf.setXfId(1);
stylesTable.putCellXf(cellXf);
XSSFCellStyle cellStyle = new XSSFCellStyle(1, 1, stylesTable, null);
- assertEquals(1, cellStyle.getFontIndex());
+ assertEquals(1, cellStyle.getFontIntIndex());
sheet.setDefaultColumnStyle(3, cellStyle);
assertEquals(1, ctWorksheet.getColsArray(0).getColArray(0).getStyle());
@Test
public void bug45338() throws IOException {
HSSFWorkbook wb = new HSSFWorkbook();
- assertEquals(4, wb.getNumberOfFonts());
+ assertEquals(4, wb.getNumberOfFontsAsInt());
HSSFSheet s = wb.createSheet();
s.createRow(0);
s.getRow(0).createCell(0);
s.getRow(1).createCell(0);
- assertEquals(4, wb.getNumberOfFonts());
+ assertEquals(4, wb.getNumberOfFontsAsInt());
HSSFFont f1 = wb.getFontAt((short) 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)
);
assertEquals(
- wb.getFontAt((short) 2),
- wb.getFontAt((short) 2)
+ wb.getFontAt(2),
+ wb.getFontAt(2)
);
assertTrue(
- wb.getFontAt((short) 0)
+ wb.getFontAt(0)
!=
- wb.getFontAt((short) 2)
+ wb.getFontAt(2)
);
// Look for a new font we have
);
HSSFFont nf = wb.createFont();
- assertEquals(5, wb.getNumberOfFonts());
+ assertEquals(5, wb.getNumberOfFontsAsInt());
assertEquals(5, nf.getIndex());
- assertEquals(nf, wb.getFontAt((short) 5));
+ assertEquals(nf, wb.getFontAt(5));
nf.setBold(false);
nf.setColor((short) 123);
nf.setTypeOffset((short) 2);
nf.setUnderline((byte) 2);
- assertEquals(5, wb.getNumberOfFonts());
- assertEquals(nf, wb.getFontAt((short) 5));
+ assertEquals(5, wb.getNumberOfFontsAsInt());
+ assertEquals(nf, wb.getFontAt(5));
// Find it now
assertNotNull(
Cell cell = row.getCell(1);
CellStyle style = cell.getCellStyle();
- assertEquals(26, style.getFontIndex());
+ assertEquals(26, style.getFontIntIndex());
row = sheet.getRow(3);
cell = row.getCell(1);
style = cell.getCellStyle();
- assertEquals(28, style.getFontIndex());
+ assertEquals(28, style.getFontIntIndex());
// check the two fonts
- HSSFFont font = wb.getFontAt((short) 26);
+ HSSFFont font = wb.getFontAt(26);
assertTrue(font.getBold());
assertEquals(10, font.getFontHeightInPoints());
assertEquals("\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF", font.getFontName());
- font = wb.getFontAt((short) 28);
+ font = wb.getFontAt(28);
assertTrue(font.getBold());
assertEquals(10, font.getFontHeightInPoints());
assertEquals("\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF", font.getFontName());
font.setStrikeout(true);
font.setColor(IndexedColors.YELLOW.getIndex());
font.setFontName("Courier");
- short font1Idx = font.getIndex();
+ int font1Idx = font.getIndexAsInt();
wb1.createCellStyle().setFont(font);
- assertEquals(num0 + 1, wb1.getNumberOfFonts());
+ assertEquals(num0 + 1, wb1.getNumberOfFontsAsInt());
CellStyle cellStyleTitle=wb1.createCellStyle();
cellStyleTitle.setFont(font);
wb1.close();
s1 = wb2.getSheetAt(0);
- assertEquals(num0 + 1, wb2.getNumberOfFonts());
- short idx = s1.getRow(0).getCell(0).getCellStyle().getFontIndex();
+ assertEquals(num0 + 1, wb2.getNumberOfFontsAsInt());
+ int idx = s1.getRow(0).getCell(0).getCellStyle().getFontIntIndex();
Font fnt = wb2.getFontAt(idx);
assertNotNull(fnt);
assertEquals(IndexedColors.YELLOW.getIndex(), fnt.getColor());
Font font2 = wb2.createFont();
font2.setItalic(true);
font2.setFontHeightInPoints((short)15);
- short font2Idx = font2.getIndex();
+ int font2Idx = font2.getIndexAsInt();
wb2.createCellStyle().setFont(font2);
- assertEquals(num0 + 2, wb2.getNumberOfFonts());
+ assertEquals(num0 + 2, wb2.getNumberOfFontsAsInt());
// Save and re-load
Workbook wb3 = _testDataProvider.writeOutAndReadBack(wb2);
s1 = wb3.getSheetAt(0);
assertNotNull(s1);
- assertEquals(num0 + 2, wb3.getNumberOfFonts());
+ assertEquals(num0 + 2, wb3.getNumberOfFontsAsInt());
assertNotNull(wb3.getFontAt(font1Idx));
assertNotNull(wb3.getFontAt(font2Idx));
@Test
public final void test45338() throws IOException {
Workbook wb = _testDataProvider.createWorkbook();
- int num0 = wb.getNumberOfFonts();
+ int num0 = wb.getNumberOfFontsAsInt();
Sheet s = wb.createSheet();
s.createRow(0);
s.getRow(1).createCell(0);
//default font
- Font f1 = wb.getFontAt((short)0);
+ Font 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));
// Look for a new font we have
// yet to add
);
Font nf = wb.createFont();
- short nfIdx = nf.getIndex();
- assertEquals(num0 + 1, wb.getNumberOfFonts());
+ int nfIdx = nf.getIndexAsInt();
+ assertEquals(num0 + 1, wb.getNumberOfFontsAsInt());
assertSame(nf, wb.getFontAt(nfIdx));
nf.setTypeOffset((short)2);
nf.setUnderline((byte)2);
- assertEquals(num0 + 1, wb.getNumberOfFonts());
+ assertEquals(num0 + 1, wb.getNumberOfFontsAsInt());
assertEquals(nf, wb.getFontAt(nfIdx));
assertEquals(wb.getFontAt(nfIdx), wb.getFontAt(nfIdx));
- assertTrue(wb.getFontAt((short)0) != wb.getFontAt(nfIdx));
+ assertTrue(wb.getFontAt(0) != wb.getFontAt(nfIdx));
// Find it now
assertNotNull(