如何设置单元格的背景色?

时间:2018-09-11 09:11:25

标签: java excel apache-poi

我正在尝试在Excel工作表上设置单元格的背景色。我无法使用XSSFColor。这是我到目前为止的内容:

XSSFCellStyle style = (XSSFCellStyle)workbook.createCellStyle();
byte[] rgb = new byte[3];
rgb[0] = (byte) 100;
rgb[1] = (byte) 150;
rgb[2] = (byte) 200;
XSSFColor color = new XSSFColor(rgb);
style.setFillForegroundColor(color);

XSSFColor color = new XSSFColor(rgb);行无法编译:

enter image description here

如何从RGB或十六进制创建自定义颜色的XSSFColor

0 个答案:

没有答案
相关问题