Author: fanningpj
Date: Sat Jan 7 22:24:49 2023
New Revision: 1906451
URL: http://svn.apache.org/viewvc?rev=1906451&view=rev
Log:
[bug-66413] try to fix HSSF code where you can set fill colors
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java?rev=1906451&r1=1906450&r2=1906451&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
Sat Jan 7 22:24:49 2023
@@ -649,8 +649,8 @@ public final class HSSFCellStyle impleme
public void setFillBackgroundColor(org.apache.poi.ss.usermodel.Color color)
{
if (color instanceof HSSFColor) {
- short index2 = ((HSSFColor)color).getIndex2();
- if (index2 != -1) setFillBackgroundColor(index2);
+ final short index = ((HSSFColor)color).getIndex();
+ if (index != -1) setFillBackgroundColor(index);
} else if (color != null) {
throw new IllegalArgumentException("HSSFCellStyle only accepts
HSSFColor instances");
}
@@ -708,8 +708,8 @@ public final class HSSFCellStyle impleme
public void setFillForegroundColor(org.apache.poi.ss.usermodel.Color color)
{
if (color instanceof HSSFColor) {
- short index2 = ((HSSFColor)color).getIndex2();
- if (index2 != -1) setFillForegroundColor(index2);
+ final short index = ((HSSFColor)color).getIndex();
+ if (index != -1) setFillForegroundColor(index);
} else if (color != null) {
throw new IllegalArgumentException("HSSFCellStyle only accepts
HSSFColor instances");
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java?rev=1906451&r1=1906450&r2=1906451&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java Sat Jan 7
22:24:49 2023
@@ -398,9 +398,15 @@ public final class CellUtil {
if (properties.containsKey(FILL_FOREGROUND_COLOR_COLOR) &&
properties.get(FILL_FOREGROUND_COLOR_COLOR) == null) {
values.remove(FILL_FOREGROUND_COLOR);
}
+ if (properties.containsKey(FILL_FOREGROUND_COLOR) &&
!properties.containsKey(FILL_FOREGROUND_COLOR_COLOR)) {
+ values.remove(FILL_FOREGROUND_COLOR_COLOR);
+ }
if (properties.containsKey(FILL_BACKGROUND_COLOR_COLOR) &&
properties.get(FILL_BACKGROUND_COLOR_COLOR) == null) {
values.remove(FILL_BACKGROUND_COLOR);
}
+ if (properties.containsKey(FILL_BACKGROUND_COLOR) &&
!properties.containsKey(FILL_BACKGROUND_COLOR_COLOR)) {
+ values.remove(FILL_BACKGROUND_COLOR_COLOR);
+ }
putAll(properties, values);
// index seems like what index the cellstyle is in the list of styles
for a workbook.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]