1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > POI 设置Excel单元格背景色(参考颜色代码)

POI 设置Excel单元格背景色(参考颜色代码)

时间:2020-02-24 11:07:32

相关推荐

POI 设置Excel单元格背景色(参考颜色代码)

// 创建一个 workbook 对象 Workbook workbook = new XSSFWorkbook();// 创建一个 sheetSheet sheet = workbook.createSheet();//创建一行Row row = sheet.createRow((short) 1);CellStyle style = workbook.createCellStyle();//关键点 IndexedColors.AQUA.getIndex() 对应颜色style.setFillForegroundColor(***IndexedColors.AQUA.getIndex()***);style.setFillPattern(CellStyle.SOLID_FOREGROUND);Cell cell = row.createCell((short) 1);cell.setCellValue("X1");cell.setCellStyle(style);

图片对应位置:

上面的单元格颜色对应下面的英语颜色表示,从X1-X49 按顺序对应;将下面对应的code填入上述代码加粗斜体位置即可。

1.IndexedColors.AQUA.getIndex()2.IndexedColors.AUTOMATIC.getIndex()3.IndexedColors.BLUE.getIndex()4.IndexedColors.BLUE_GREY.getIndex()5.IndexedColors.BRIGHT_GREEN.getIndex()6.IndexedColors.BROWN.getIndex()7.IndexedColors.CORAL.getIndex()8.IndexedColors.CORNFLOWER_BLUE.getIndex()9.IndexedColors.DARK_BLUE.getIndex()10.IndexedColors.DARK_GREEN.getIndex()11.IndexedColors.DARK_RED.getIndex()12.IndexedColors.DARK_TEAL.getIndex()13.IndexedColors.DARK_YELLOW.getIndex()14.IndexedColors.GOLD.getIndex()15.IndexedColors.GREEN.getIndex()16.IndexedColors.GREY_25_PERCENT.getIndex()17.IndexedColors.GREY_40_PERCENT.getIndex()18.IndexedColors.GREY_50_PERCENT.getIndex()19.IndexedColors.GREY_80_PERCENT.getIndex()20.IndexedColors.INDIGO.getIndex()21.IndexedColors.LAVENDER.getIndex()22.IndexedColors.LEMON_CHIFFON.getIndex()23.IndexedColors.LIGHT_BLUE.getIndex()24.IndexedColors.LEMON_CHIFFON.getIndex()25.IndexedColors.LIGHT_BLUE.getIndex()26.IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex()27.IndexedColors.LIGHT_GREEN.getIndex()28.IndexedColors.LIGHT_ORANGE.getIndex()29.IndexedColors.LIGHT_TURQUOISE.getIndex()30.IndexedColors.LIGHT_YELLOW.getIndex()31.IndexedColors.LIME.getIndex()32.IndexedColors.MAROON.getIndex()33.IndexedColors.OLIVE_GREEN.getIndex()34.IndexedColors.ORANGE.getIndex()35.IndexedColors.ORCHID.getIndex()36.IndexedColors.PALE_BLUE.getIndex()37.IndexedColors.PINK.getIndex()38.IndexedColors.PLUM.getIndex()39.IndexedColors.RED.getIndex()40.IndexedColors.ROSE.getIndex()41.IndexedColors.ROYAL_BLUE.getIndex()42.IndexedColors.SEA_GREEN.getIndex()43.IndexedColors.SKY_BLUE.getIndex()44.IndexedColors.TAN.getIndex()45.IndexedColors.TEAL.getIndex()46.IndexedColors.TURQUOISE.getIndex()47.IndexedColors.VIOLET.getIndex()48.IndexedColors.WHITE.getIndex()49.IndexedColors.YELLOW.getIndex()

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