700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > POI 设置单元格背景色 背景色编码与实际颜色对照表(SXSSFWorkbook4.1.2)

POI 设置单元格背景色 背景色编码与实际颜色对照表(SXSSFWorkbook4.1.2)

时间:2018-12-15 07:33:22

相关推荐

POI 设置单元格背景色 背景色编码与实际颜色对照表(SXSSFWorkbook4.1.2)

本次用的poi的版本是4.1.2

SXSSFWorkbook wb = new SXSSFWorkbook();

CellStyle style = wb.createCellStyle();

style.setAlignment(HSSFCellStyle.ALIGN_CENTER)

style.setFillForegroundColor(IndexedColors.CORNFLOWER_BLUE.getIndex());// 设置背景色

style.setFillPattern(FillPatternType.SOLID_FOREGROUND);

如果是3版本一下

style.setFillPattern(CellStyle.SOLID_FOREGROUND);

上面的单元格颜色对应下面的英语颜色表示,从X1-X49 按顺序对应;IndexedColors.AQUA.getIndex();IndexedColors.AUTOMATIC.getIndex(); IndexedColors.BLUE.getIndex(); IndexedColors.BLUE_GREY.getIndex();IndexedColors.BRIGHT_GREEN.getIndex();IndexedColors.BROWN.getIndex();IndexedColors.CORAL.getIndex();IndexedColors.CORNFLOWER_BLUE.getIndex();IndexedColors.DARK_BLUE.getIndex();IndexedColors.DARK_GREEN.getIndex();IndexedColors.DARK_RED.getIndex();IndexedColors.DARK_TEAL.getIndex();IndexedColors.DARK_YELLOW.getIndex();IndexedColors.GOLD.getIndex();IndexedColors.GREEN.getIndex();IndexedColors.GREY_25_PERCENT.getIndex();IndexedColors.GREY_40_PERCENT.getIndex();IndexedColors.GREY_50_PERCENT.getIndex();IndexedColors.GREY_80_PERCENT.getIndex();IndexedColors.INDIGO.getIndex();IndexedColors.LAVENDER.getIndex();IndexedColors.LEMON_CHIFFON.getIndex();IndexedColors.LIGHT_BLUE.getIndex();IndexedColors.LEMON_CHIFFON.getIndex();IndexedColors.LIGHT_BLUE.getIndex();IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex();IndexedColors.LIGHT_GREEN.getIndex();IndexedColors.LIGHT_ORANGE.getIndex();IndexedColors.LIGHT_TURQUOISE.getIndex();IndexedColors.LIGHT_YELLOW.getIndex();IndexedColors.LIME.getIndex();IndexedColors.MAROON.getIndex();IndexedColors.OLIVE_GREEN.getIndex();IndexedColors.ORANGE.getIndex();IndexedColors.ORCHID.getIndex();IndexedColors.PALE_BLUE.getIndex();IndexedColors.PINK.getIndex();IndexedColors.PLUM.getIndex();IndexedColors.RED.getIndex();IndexedColors.ROSE.getIndex();IndexedColors.ROYAL_BLUE.getIndex();IndexedColors.SEA_GREEN.getIndex();IndexedColors.SKY_BLUE.getIndex();IndexedColors.TAN.getIndex();IndexedColors.TEAL.getIndex();IndexedColors.TURQUOISE.getIndex();IndexedColors.VIOLET.getIndex();IndexedColors.WHITE.getIndex();IndexedColors.YELLOW.getIndex();

HSSFCellStyle style = workbook.createCellStyle();style.setFillBackgroundColor(HSSFColor.AQUA.index);cell.setCellStyle(style);

参考/linvan/p/10860538.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。