John,

 Alas that does not correctly work either. I'm suspecting a bug.

Thanks, Brian


On Tue, Nov 17, 2015 at 7:46 PM, John <[email protected]> wrote:

> 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
>



-- 
Brian Milnes
CIO XBRL Cloud
206 406 7576

Reply via email to