Przeglądaj źródła

[bug-66413] try to fix HSSF code where you can set fill colors

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1906451 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_2_4
PJ Fanning 1 rok temu
rodzic
commit
5c964e4194

+ 4
- 4
poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java Wyświetl plik

public void setFillBackgroundColor(org.apache.poi.ss.usermodel.Color color) public void setFillBackgroundColor(org.apache.poi.ss.usermodel.Color color)
{ {
if (color instanceof HSSFColor) { 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) { } else if (color != null) {
throw new IllegalArgumentException("HSSFCellStyle only accepts HSSFColor instances"); throw new IllegalArgumentException("HSSFCellStyle only accepts HSSFColor instances");
} }
public void setFillForegroundColor(org.apache.poi.ss.usermodel.Color color) public void setFillForegroundColor(org.apache.poi.ss.usermodel.Color color)
{ {
if (color instanceof HSSFColor) { 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) { } else if (color != null) {
throw new IllegalArgumentException("HSSFCellStyle only accepts HSSFColor instances"); throw new IllegalArgumentException("HSSFCellStyle only accepts HSSFColor instances");
} }

+ 6
- 0
poi/src/main/java/org/apache/poi/ss/util/CellUtil.java Wyświetl plik

if (properties.containsKey(FILL_FOREGROUND_COLOR_COLOR) && properties.get(FILL_FOREGROUND_COLOR_COLOR) == null) { if (properties.containsKey(FILL_FOREGROUND_COLOR_COLOR) && properties.get(FILL_FOREGROUND_COLOR_COLOR) == null) {
values.remove(FILL_FOREGROUND_COLOR); 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) { if (properties.containsKey(FILL_BACKGROUND_COLOR_COLOR) && properties.get(FILL_BACKGROUND_COLOR_COLOR) == null) {
values.remove(FILL_BACKGROUND_COLOR); 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); putAll(properties, values);


// index seems like what index the cellstyle is in the list of styles for a workbook. // index seems like what index the cellstyle is in the list of styles for a workbook.

Ładowanie…
Anuluj
Zapisz