Hi Brian,
Maybe you can try this.
public static byte[] getCellFontColor(XSSFCell cell) {
XSSFCellStyle cellStyle = cell.getCellStyle();
if(null == cellStyle) {
return null;
}
List<CTColor> colorList = cellStyle.getFont().getCTFont().getColorList();
if (colorList.size() == 1) {
CTColor ctColor = colorList.get(0);
return ctColor.getRgb();
}
return null;
}public static byte[] getCellBackgroundColor(XSSFCell cell) {
XSSFCellStyle cellStyle = cell.getCellStyle();
if(null == cellStyle) {
return null;
}
XSSFColor backgroundColor = cellStyle.getFillForegroundColorColor();
if(null == backgroundColor) {
return null;
}
return backgroundColor.getRgb();
}
------------------ ???????? ------------------
??????: "Brian Milnes";<[email protected]>;
????????: 2015??11??18??(??????) ????1:43
??????: "user"<[email protected]>;
????: Correctly getting the color of an XSSFCellStyle
I've got spreadsheet that has multiple gray cells which are blank
and I'd like to leave blank, and multiple white cells which are blank and I
would like to fill them.
I want to recognize them and not fill them but I can't get the logic right
or I have an issue with 3.13.
They both can end up with a
SOLID_FOREGROUND fill,
getFillForegroundColor of 0
and getFillFillForgroundColor of ARGB of -1 -1 -1 -1.
What is the correct way to differentiate empty white versus gray cells?
Thanks, Brian