Hi,
I build an excel sheet with colored cells and texts, and it works fine
when I use the predefined colors. But when I add colors myself, I get
grey scale colors. Do I have to change some settings in the Workbook (or
anywhere else)?

I set the palette and colors 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;
}

Thanks for your help!

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/

Reply via email to