https://issues.apache.org/bugzilla/show_bug.cgi?id=56774
Bug ID: 56774
Summary: Inability to set custom colors in Custom Formatting
Pattern Formatting
Product: POI
Version: 3.10
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Under XSSF there is no way of setting custom colors when using
ConditionalFormatting. I believe in the HSSF side we can alter the pallet to
replace an indexed color with a custom collor and then use that but on XSSF
side this is not possible.
Would it be possible to add the following funtion to XSSFPatternFormatting
class. I tried this hack and seems to be working fine.
public void setFillBackgroundColor(java.awt.Color clr){
CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill()
: _fill.addNewPatternFill();
CTColor bgColor = CTColor.Factory.newInstance();
bgColor.setRgb(new byte[]{(byte)clr.getRed(), (byte)clr.getGreen(),
(byte)clr.getBlue()});
ptrn.setBgColor(bgColor);
}
With this method, I can set a custom color as
ConditionalFormattingRule colorHigh =
sheetCF.createConditionalFormattingRule(ComparisonOperator.GT, "H$48");
XSSFPatternFormatting highFill =
(XSSFPatternFormatting)colorHigh.createPatternFormatting();
highFill.setFillBackgroundColor(new java.awt.Color(198, 239, 206));
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]