This project is read-only.

Using a custom color

Sep 2, 2009 at 7:01 PM

Is it possible to change the color indexing in a workbook through NPOI?  I want to use a custom color rather than the lmited ones provided with "NPOI.HSSF.Util.HSSFColor".  Anyway, I cannot seem to find a way to do this.  Mainly I'm looking for a way to set the background color of a cell to a specific color.  Thanks.

Sep 2, 2009 at 7:27 PM

Found the answer myself.  I went to the POI documentation for it.  By the way here is how you do it.

HSSFWorkbook workbook = new HSSFWorkbook();
HSSFPalette palette = workbook.GetCustomPalette();
palette.SetColorAtIndex(NPOI.HSSF.Util.HSSFColor.LIME.index, (byte)202, (byte)203, (byte)204);
or you can set the specific index location
palette.SetColorAtIndex(22, (byte)202, (byte)203, (byte)204);

Jan 4, 2010 at 12:04 PM

Do you know how to put a specific color to a cell without using the palette?

What is the method for putting a 32 (or 24) bit color to a cell like Excel does?