static String getBgColorFromCell ( final Workbook wb , final Cell poiCell , final CellStyle cellStyle ) { String style = "" ; if ( poiCell instanceof HSSFCell ) { int bkColorIndex = cellStyle . getFillForegroundColor ( ) ; HSSFColor color = HSSFColor . getIndexHash ( ) . get ( bkColorIndex ) ; if ( color != null ) { // correct color for customPalette HSSFPalette palette = ( ( HSSFWorkbook ) wb ) . getCustomPalette ( ) ; HSSFColor color2 = palette . getColor ( bkColorIndex ) ; if ( ! color . getHexString ( ) . equalsIgnoreCase ( color2 . getHexString ( ) ) ) { color = color2 ; } style = "background-color:rgb(" + FacesUtility . strJoin ( color . getTriplet ( ) , "," ) + ");" ; } } else if ( poiCell instanceof XSSFCell ) { XSSFColor color = ( ( XSSFCell ) poiCell ) . getCellStyle ( ) . getFillForegroundColorColor ( ) ; if ( color != null ) { style = "background-color:rgb(" + FacesUtility . strJoin ( getTripletFromXSSFColor ( color ) , "," ) + ");" ; } } return style ; }
Gets the bg color from cell .