* @param rect selection range
* @param color color to use
*/
public static void setBackgroundColor(Worksheet sheet, Rect rect, String color) {
final Book book = (Book) sheet.getWorkbook();
final Color bsColor = BookHelper.HTMLToColor(book, color);
for (int row = rect.getTop(); row <= rect.getBottom(); row++)
for (int col = rect.getLeft(); col <= rect.getRight(); col++) {
Cell cell = Utils.getOrCreateCell(sheet, row, col);
CellStyle cs = cell.getCellStyle();
final Color srcColor = cs.getFillForegroundColorColor();
if (Objects.equals(srcColor, bsColor)) {
continue;
}
CellStyle newCellStyle = book.createCellStyle();
newCellStyle.cloneStyleFrom(cs);