Free Support Forum - aspose.com

Can not set color for cells

Hi,
Please help:

Cell cell = myworksheet.getCells().getCell(i, j);
cell.getStyle().setColor(color);

and this does not work.

Hi,

Please use cell.setStyle(Style) to assign the custom style to given cell after you specified all properties of the Style object. Code should be like following:

Java


Cell cell = myworksheet.getCells().getCell(i, j);

Style style = cell.getStyle();

style.setColor(color);

cell.setStyle(style);