mirror of https://github.com/apache/poi.git
Support unsetting the XSSF CF pattern colours
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1691081 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d7e781d349
commit
da1abea6b9
|
@ -64,30 +64,40 @@ public class XSSFPatternFormatting implements PatternFormatting {
|
||||||
|
|
||||||
public void setFillBackgroundColor(Color bg) {
|
public void setFillBackgroundColor(Color bg) {
|
||||||
XSSFColor xcolor = XSSFColor.toXSSFColor(bg);
|
XSSFColor xcolor = XSSFColor.toXSSFColor(bg);
|
||||||
setFillBackgroundColor(xcolor.getCTColor());
|
if (xcolor == null) setFillBackgroundColor((CTColor)null);
|
||||||
|
else setFillBackgroundColor(xcolor.getCTColor());
|
||||||
}
|
}
|
||||||
public void setFillBackgroundColor(short bg) {
|
public void setFillBackgroundColor(short bg) {
|
||||||
CTColor bgColor = CTColor.Factory.newInstance();
|
CTColor bgColor = CTColor.Factory.newInstance();
|
||||||
bgColor.setIndexed(bg);
|
bgColor.setIndexed(bg);
|
||||||
setFillBackgroundColor(bgColor);
|
setFillBackgroundColor(bgColor);
|
||||||
}
|
}
|
||||||
public void setFillBackgroundColor(CTColor color) {
|
private void setFillBackgroundColor(CTColor color) {
|
||||||
CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill();
|
CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill();
|
||||||
ptrn.setBgColor(color);
|
if (color == null) {
|
||||||
|
ptrn.unsetBgColor();
|
||||||
|
} else {
|
||||||
|
ptrn.setBgColor(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFillForegroundColor(Color fg) {
|
public void setFillForegroundColor(Color fg) {
|
||||||
XSSFColor xcolor = XSSFColor.toXSSFColor(fg);
|
XSSFColor xcolor = XSSFColor.toXSSFColor(fg);
|
||||||
setFillForegroundColor(xcolor.getCTColor());
|
if (xcolor == null) setFillForegroundColor((CTColor)null);
|
||||||
|
else setFillForegroundColor(xcolor.getCTColor());
|
||||||
}
|
}
|
||||||
public void setFillForegroundColor(short fg) {
|
public void setFillForegroundColor(short fg) {
|
||||||
CTColor fgColor = CTColor.Factory.newInstance();
|
CTColor fgColor = CTColor.Factory.newInstance();
|
||||||
fgColor.setIndexed(fg);
|
fgColor.setIndexed(fg);
|
||||||
setFillForegroundColor(fgColor);
|
setFillForegroundColor(fgColor);
|
||||||
}
|
}
|
||||||
public void setFillForegroundColor(CTColor color) {
|
private void setFillForegroundColor(CTColor color) {
|
||||||
CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill();
|
CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill();
|
||||||
ptrn.setFgColor(color);
|
if (color == null) {
|
||||||
|
ptrn.unsetFgColor();
|
||||||
|
} else {
|
||||||
|
ptrn.setFgColor(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFillPattern(short fp){
|
public void setFillPattern(short fp){
|
||||||
|
|
Loading…
Reference in New Issue