我想在POI中为CellStyle设置自定义颜色,但似乎没有应用。我有以下代码:
如果我使用不同的填充模式并执行以下操作:
XSSFColor color = new XSSFColor(new byte[]{ (byte) 60,
(byte) 120,
(byte) 216 });
CellStyle style = workBook.createCellStyle();
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
style.setFillForegroundColor(color);
XSSFCell cell = createCell(row, CellType.STRING, style, cellIndex);
我有以下的Gradle依赖:
implementation("org.apache.poi:poi:5.2.3")
implementation("org.apache.poi:poi-ooxml:5.2.3")
如果我使用不同的填充模式并执行以下操作:
style.setFillPattern(FillPatternType.SOLID_FOREGROUND)
,则背景将被设置,但填充模式显然不是实心的。那么正确的做法是什么?