Custom background color in conditional formatting using Apache POI

I have an XSSF book, and I want to define my own background color in a set of cells with certain conditional formatting, but the problem is that the method setFillBackgroundColor()in the class PatternFormattingtakes only a short type argument, and not XSSFColoras follows:

PatternFormatting fill = rule1.createPatternFormatting();
fill.setFillBackgroundColor(new XSSFColor(new java.awt.Color(80, 80, 100));
fill.setFillPattern(PatternFormatting.SOLID_FOREGROUND);

I can do it fill.setFillBackgroundColor(IndexedColors.RED.index), but I want to define my own color. How can i do this?

+4
source share
1 answer

, , 2014 , , , Apache POI 3.13. , , 3,13, :

fill.setFillBackgroundColor(new XSSFColor(new java.awt.Color(80, 80, 100))

(. : https://bz.apache.org/bugzilla/show_bug.cgi?id=56774)

0

All Articles