Author: nick
Date: Tue Jul 14 21:10:14 2015
New Revision: 1691081

URL: http://svn.apache.org/r1691081
Log:
Support unsetting the XSSF CF pattern colours

Modified:
    
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPatternFormatting.java

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPatternFormatting.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPatternFormatting.java?rev=1691081&r1=1691080&r2=1691081&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPatternFormatting.java
 (original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPatternFormatting.java
 Tue Jul 14 21:10:14 2015
@@ -64,30 +64,40 @@ public class XSSFPatternFormatting imple
 
     public void setFillBackgroundColor(Color bg) {
         XSSFColor xcolor = XSSFColor.toXSSFColor(bg);
-        setFillBackgroundColor(xcolor.getCTColor());
+        if (xcolor == null) setFillBackgroundColor((CTColor)null);
+        else setFillBackgroundColor(xcolor.getCTColor());
     }
     public void setFillBackgroundColor(short bg) {
         CTColor bgColor = CTColor.Factory.newInstance();
         bgColor.setIndexed(bg);
         setFillBackgroundColor(bgColor);
     }
-    public void setFillBackgroundColor(CTColor color) {
+    private void setFillBackgroundColor(CTColor color) {
         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) {
         XSSFColor xcolor = XSSFColor.toXSSFColor(fg);
-        setFillForegroundColor(xcolor.getCTColor());
+        if (xcolor == null) setFillForegroundColor((CTColor)null);
+        else setFillForegroundColor(xcolor.getCTColor());
     }
     public void setFillForegroundColor(short fg) {
         CTColor fgColor = CTColor.Factory.newInstance();
         fgColor.setIndexed(fg);
         setFillForegroundColor(fgColor);
     }
-    public void setFillForegroundColor(CTColor color) {
+    private void setFillForegroundColor(CTColor color) {
         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){



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to