diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
index c7d1f85f32..b221bf5491 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
@@ -829,6 +829,19 @@ public class XSSFCellStyle implements CellStyle, Duplicatable {
addFill(ct);
}
+ /**
+ * Set the background fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value.
+ *
+ * @param color the color to use
+ * @since POI 5.2.3
+ */
+ @Override
+ public void setFillBackgroundColor(org.apache.poi.ss.usermodel.Color color) {
+ if (color instanceof XSSFColor) {
+ setFillBackgroundColor((XSSFColor)color);
+ }
+ }
+
/**
* Set the background fill color represented as a indexed color value.
*
@@ -882,6 +895,19 @@ public class XSSFCellStyle implements CellStyle, Duplicatable {
addFill(ct);
}
+
+ /**
+ * Set the foreground fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value.
+ *
+ * @param color the color to use
+ * @since POI 5.2.3
+ */
+ @Override
+ public void setFillForegroundColor(org.apache.poi.ss.usermodel.Color color) {
+ if (color instanceof XSSFColor) {
+ setFillForegroundColor((XSSFColor)color);
+ }
+ }
/**
* Set the foreground fill color as a indexed color value
diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
index d6408bc0a4..9bb826d56a 100644
--- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
+++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
@@ -637,6 +637,21 @@ public final class HSSFCellStyle implements CellStyle, Duplicatable {
_format.setFillBackground(bg);
checkDefaultBackgroundFills();
}
+
+ /**
+ * Set the background fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value.
+ *
+ * @param color the color to use
+ * @since POI 5.2.3
+ */
+ @Override
+ public void setFillBackgroundColor(org.apache.poi.ss.usermodel.Color color)
+ {
+ if (color instanceof HSSFColor) {
+ short index2 = ((HSSFColor)color).getIndex2();
+ if (index2 != -1) setFillBackgroundColor(index2);
+ }
+ }
/**
* Get the background fill color.
@@ -678,6 +693,21 @@ public final class HSSFCellStyle implements CellStyle, Duplicatable {
_format.setFillForeground(bg);
checkDefaultBackgroundFills();
}
+
+ /**
+ * Set the foreground fill color represented as a {@link org.apache.poi.ss.usermodel.Color} value.
+ *
+ * @param color the color to use
+ * @since POI 5.2.3
+ */
+ @Override
+ public void setFillForegroundColor(org.apache.poi.ss.usermodel.Color color)
+ {
+ if (color instanceof HSSFColor) {
+ short index2 = ((HSSFColor)color).getIndex2();
+ if (index2 != -1) setFillForegroundColor(index2);
+ }
+ }
/**
* Get the foreground fill color.
diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/CellStyle.java b/poi/src/main/java/org/apache/poi/ss/usermodel/CellStyle.java
index 983ba99b9c..c4e539da8b 100644
--- a/poi/src/main/java/org/apache/poi/ss/usermodel/CellStyle.java
+++ b/poi/src/main/java/org/apache/poi/ss/usermodel/CellStyle.java
@@ -311,6 +311,15 @@ public interface CellStyle {
*/
void setFillBackgroundColor(short bg);
+ /**
+ * set the background fill color.
+ * use not a indexed color but a {@link org.apache.poi.ss.usermodel.Color)
+ *
+ * @param color org.apache.poi.ss.usermodel.Color to set
+ * @since POI 5.2.3
+ */
+ void setFillBackgroundColor(Color color);
+
/**
* get the background fill color, if the fill
* is defined with an indexed color.
@@ -334,6 +343,15 @@ public interface CellStyle {
*/
void setFillForegroundColor(short bg);
+ /**
+ * set the foreground fill color.
+ * use not a indexed color but a {@link org.apache.poi.ss.usermodel.Color)
+ *
+ * @param color org.apache.poi.ss.usermodel.Color to set
+ * @since POI 5.2.3
+ */
+ void setFillForegroundColor(Color color);
+
/**
* get the foreground fill color, if the fill
* is defined with an indexed color.
diff --git a/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java b/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java
index 184eafc91f..0665cefa38 100644
--- a/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java
+++ b/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java
@@ -56,6 +56,10 @@ public final class CellUtil {
public static final String DATA_FORMAT = "dataFormat";
public static final String FILL_BACKGROUND_COLOR = "fillBackgroundColor";
public static final String FILL_FOREGROUND_COLOR = "fillForegroundColor";
+
+ public static final String FILL_BACKGROUND_COLOR_COLOR = "fillBackgroundColorColor";
+ public static final String FILL_FOREGROUND_COLOR_COLOR = "fillForegroundColorColor";
+
public static final String FILL_PATTERN = "fillPattern";
public static final String FONT = "font";
public static final String HIDDEN = "hidden";
@@ -79,6 +83,13 @@ public final class CellUtil {
DATA_FORMAT,
ROTATION
)));
+
+ private static final Set