Hi again,
I found a solution. It works like this:

      private HSSFPalette palette = new HSSFPalette(new 
PaletteRecord((short)0x92)){};
        
        protected final HSSFColor getColor(final Color col){
                HSSFColor c;
                c = palette.findColor((byte)col.getRed(), (byte)col.getGreen(), 
(byte)col.getBlue());
                if(c==null){
                        try{
                                c = palette.addColor((byte)col.getRed(), 
(byte)col.getGreen(), (byte)col.getBlue());
                        } catch (RuntimeException re){
                                c = 
palette.findSimilarColor((byte)col.getRed(), (byte)col.getGreen(), 
(byte)col.getBlue());
                        }
                }
                return c;
        } 

First tests show, that it works. But I seem to get only black and white (and 
rasterizations), but no "real" colors.
Is there a seting somewhere to activate colors or am I limiting the 
PaletteRecord in some way?
Regards
Claus

-----Ursprüngliche Nachricht-----
Von: Claus Luethje [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 24. Januar 2006 09:14
An: [email protected]
Betreff: Convert AWT colors to "excel colors"

Hi,
I want to use AWT colors to define color settings in excel. Due to the color 
index approach of excel, this isn't as easy as i wished. Is there a possibility 
to add a new color to an index for a Worksheet? Or do you have any other idea 
how to solve this?
Regards
Claus

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


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

Reply via email to