Create custom color for cell background by using java color class
Create custom color-
XSSFWorkbook workBook = new XSSFWorkbook();
IndexedColorMap colorMap = workbook.getStylesSource().getIndexedColors(); Font tableHeadOneFontStyle = workbook.createFont(); tableHeadOneFontStyle.setBold( true );
tableHeadOneFontStyle.setColor( IndexedColors.BLACK.getIndex() );
XSSFCellStyle
tableHeaderOneColOneStyle = workbook.createCellStyle();
tableHeaderOneColOneStyle.setFont( tableHeadOneFontStyle );
tableHeaderOneColOneStyle.setFillForegroundColor( new XSSFColor( new
java.awt.Color( 255, 231, 153 ), colorMap ) );
tableHeaderOneColOneStyle.setFillPattern( FillPatternType.SOLID_FOREGROUND );
tableHeaderOneColOneStyle = setLeftRightBorderColor( tableHeaderOneColOneStyle );
tableHeaderOneColOneStyle = alignCenter( tableHeaderOneColOneStyle );
Comments
Post a Comment