如何将单元格的背景颜色设置为任何RGB值?

我试图设置一个单元格背景颜色像这样的RGB值

XSSFCellStyle instructionStyle = wb.createCellStyle(); instructionStyle.setWrapText(true); XSSFColor myColor = new XSSFColor(new java.awt.Color(0, 73,144)); instructionStyle.setFillForegroundColor(myColor); instructionStyle.setAlignment(HorizontalAlignment.CENTER); 

甚至它编译的水平alignment中心没有其他的效果,单元格的look.can有人告诉我什么是错误的代码?谢谢

你可以尝试添加以下内容吗?

 instructionStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);