You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Alan Bowsher <al...@supplydynamics.com> on 2011/07/12 17:22:48 UTC

Can't get the color for built-in styles

We have some code that looks like this (in Groovy) to get the color out
of a cell from an Excel 2010 file (xlsx):

 

        sheet.rowIterator().each {

            Row row ->

            row.cellIterator().each {

                Cell cell ->

                if (columns == null ||
columns.contains(cell.getColumnIndex())) {

                    CellStyle style = cell.getCellStyle()

                    XSSFColor color = (XSSFColor)
style.getFillForegroundColorColor()

                    if (color != null && !result.contains(color)) {

                        //                        println color.getRgb()

                        //                        println
color.getARGBHex()

                        result.add(color)

                    }

                }

            }

        }

 

This works when the user uses the bucket to fill the color in a cell in
Excel.  However, if they use the pre-configured styles (such as
Good/Bad/Neutral), even though they seem to use a fill color, POI is not
picking up the color (either through the foreground or background - both
return null).

 

Is there a way to do this?  Is this a known problem/limitation?

 

Thanks,

Alan

 

 


RE: Can't get the color for built-in styles

Posted by Nick Burch <ni...@alfresco.com>.
On Mon, 18 Jul 2011, Alan Bowsher wrote:
> Bump... any clues?

Did you try 3.8 beta 3? I seem to recall us fixing some theme based colour 
bugs fairly recently

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Can't get the color for built-in styles

Posted by Alan Bowsher <al...@supplydynamics.com>.
Bump... any clues?

Thanks...

-----Original Message-----
From: Alan Bowsher [mailto:alan.bowsher@supplydynamics.com] 
Sent: Tuesday, July 12, 2011 11:23 AM
To: user@poi.apache.org
Subject: Can't get the color for built-in styles

We have some code that looks like this (in Groovy) to get the color out
of a cell from an Excel 2010 file (xlsx):

 

        sheet.rowIterator().each {

            Row row ->

            row.cellIterator().each {

                Cell cell ->

                if (columns == null ||
columns.contains(cell.getColumnIndex())) {

                    CellStyle style = cell.getCellStyle()

                    XSSFColor color = (XSSFColor)
style.getFillForegroundColorColor()

                    if (color != null && !result.contains(color)) {

                        //                        println color.getRgb()

                        //                        println
color.getARGBHex()

                        result.add(color)

                    }

                }

            }

        }

 

This works when the user uses the bucket to fill the color in a cell in
Excel.  However, if they use the pre-configured styles (such as
Good/Bad/Neutral), even though they seem to use a fill color, POI is not
picking up the color (either through the foreground or background - both
return null).

 

Is there a way to do this?  Is this a known problem/limitation?

 

Thanks,

Alan

 

 


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

________________________________________________________________________
_____
Scanned by IBM Email Security Management Services powered by
MessageLabs. For more information please visit
http://www-935.ibm.com/services/us/index.wss/offerfamily/iss/a1026954
________________________________________________________________________
_____

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org