You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Karr, David" <da...@wamu.net> on 2007/03/10 20:56:54 UTC

How to determine what color a cell is from the style color index?

I'm reading a spreadsheet, and I have a cell and it's cellstyle, so I
can get the fillbg index.  How do I tell what color that is?  I can't
even figure it out by looking at the "Constant Field Values" link in the
javadoc.  A cell that appears to be white shows a value of 65, and a
cell that appears to be grey shows a value of 64. I don't even see those
values as values of the "index" field in the constants page.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: How to determine what color a cell is from the style color index?

Posted by Òscar Álvarez Vilaplana <os...@poal.org>.
Hello,

2007/3/10, Karr, David <da...@wamu.net>:
> I'm reading a spreadsheet, and I have a cell and it's cellstyle, so I
> can get the fillbg index.  How do I tell what color that is?

Are you trying to obtain the related HSSFColor or the triplet rgb for
that color?

> I can't
> even figure it out by looking at the "Constant Field Values" link in the
> javadoc.  A cell that appears to be white shows a value of 65, and a
> cell that appears to be grey shows a value of 64. I don't even see those
> values as values of the "index" field in the constants page.

I haven't tried it but I think you may want to try something like:

HSSFPalette pal = wb.getCustomPalette();
HSSFColor c = pal.getColor(index);
short[] triplet = c.getTriplet();

Regards,

Òscar

RE: How to determine what color a cell is from the style color index?

Posted by "Karr, David" <da...@wamu.net>.
If anyone's wondering, I gave up on this approach. It's more effective
to use merged regions. 

> -----Original Message-----
> From: Karr, David 
> Sent: Saturday, March 10, 2007 11:57 AM
> To: POI Users List
> Subject: How to determine what color a cell is from the style 
> color index?
> 
> I'm reading a spreadsheet, and I have a cell and it's 
> cellstyle, so I can get the fillbg index.  How do I tell what 
> color that is?  I can't even figure it out by looking at the 
> "Constant Field Values" link in the javadoc.  A cell that 
> appears to be white shows a value of 65, and a cell that 
> appears to be grey shows a value of 64. I don't even see 
> those values as values of the "index" field in the constants page.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/