poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Luethje" <Luet...@osys.ch>
Subject AW: Convert AWT colors to "excel colors"
Date Tue, 24 Jan 2006 10:20:37 GMT
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:Luethje@osys.ch] 
Gesendet: Dienstag, 24. Januar 2006 09:14
An: poi-user@jakarta.apache.org
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: 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/


Mime
View raw message