@Test
public void testGetSetCellBackgroundColor() throws Exception {
int rowindex = 2, columnindex = 0;
Table table = odsdoc.getTableByName("Sheet1");
Cell fcell = table.getCellByPosition(columnindex, rowindex);
fcell.setCellBackgroundColor(new Color("#ffffff"));
saveods();
// reload
loadOutputSpreadsheet();
table = odsdoc.getTableByName("Sheet1");
fcell = table.getCellByPosition(columnindex, rowindex);
// set color as DEFAULT_BACKGROUND_COLOR #FFFFFF
Assert.assertEquals("#ffffff", fcell.getCellBackgroundColor().toString());
Color expectedColor = Color.valueOf("#000000");
fcell.setCellBackgroundColor(expectedColor);
saveods();
// reload
loadOutputSpreadsheet();
table = odsdoc.getTableByName("Sheet1");
fcell = table.getCellByPosition(columnindex, rowindex);
Assert.assertEquals(expectedColor.toString(), fcell.getCellBackgroundColor().toString());
SpreadsheetDocument ods;
try {
ods = SpreadsheetDocument.newSpreadsheetDocument();
Table tbl = ods.getTableByName("Sheet1");
Cell cell = tbl.getCellByPosition(0, 0);
Color actualBackColor = cell.getCellBackgroundColor();
Assert.assertEquals("#ffffff", actualBackColor.toString());
} catch (Exception e) {
Logger.getLogger(TableCellTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
Assert.fail(e.getMessage());
}
}