The background color setting in POI is as follows:
HSSFCellStyle cellStyle = wb.createCellStyle();cellStyle.setFillBackgroundColor(HSSFColor.TEAL.index); //设置背景色cellStyle.setFillForegroundColor(HSSFColor.TEAL.index);// 设置前景色 cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
Attached: Hssfcolor color definition
Color |
Execution Results |
Hssfcolor.royal_blue |
|
Hssfcolor.teal |
|
Hssfcolor.lime |
|
Hssfcolor.pale_blue |
|
Hssfcolor.aqua |
|
Hssfcolor.green |
|
Hssfcolor.turquoise |
|
Hssfcolor.dark_blue |
|
Hssfcolor.cornflower_blue |
|
Hssfcolor.olive_green |
|
Hssfcolor.white |
|
Hssfcolor.light_turquoise |
|
Hssfcolor.lemon_chiffon |
|
Hssfcolor.light_green |
|
Hssfcolor.blue |
|
Hssfcolor.dark_red |
|
Hssfcolor.coral |
|
Hssfcolor.red |
|
Hssfcolor.light_yellow |
|
Hssfcolor.sky_blue |
|
Hssfcolor.brown |
|
Hssfcolor.sea_green |
|
Hssfcolor.indigo |
|
Hssfcolor.maroon |
|
Hssfcolor.grey_80_percent |
|
Hssfcolor.grey_25_percent |
|
Hssfcolor.dark_green |
|
Hssfcolor.yellow |
|
Hssfcolor.gold |
|
Hssfcolor.grey_40_percent |
|
Hssfcolor.dark_teal |
|
Hssfcolor.pink |
|
Hssfcolor.orchid |
|
Hssfcolor.light_blue |
|
Hssfcolor.light_cornflower_blue |
|
Hssfcolor.black |
|
Hssfcolor.dark_yellow |
|
Hssfcolor.violet |
|
Hssfcolor.lavender |
|
Hssfcolor.rose |
|
Hssfcolor.blue_grey |
|
Hssfcolor.light_orange |
|
Hssfcolor.orange |
|
Hssfcolor.grey_50_percent |
|
Itmyhome
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Poi action Excel set foreground color background