private void CreateColours(string colourName, byte red, byte green, byte blue) { var palette = XlsWorkbook.GetCustomPalette(); var colour = palette.FindSimilarColor(red, green, blue) ?? palette.AddColor(red, green, blue); _colours.Add(colourName, colour); }
private void CreateColours(string colourName, byte red, byte green, byte blue) { HSSFPalette palette = XlsWorkbook.GetCustomPalette(); HSSFColor colour = palette.FindSimilarColor(red, green, blue); if (colour == null) { // First 64 are system colours //srl this code does not work with the latest version of NPOI //if (NPOI.HSSF.Record.PaletteRecord.STANDARD_PALETTE_SIZE < 64 ) //{ // NPOI.HSSF.Record.PaletteRecord.STANDARD_PALETTE_SIZE = 64; //} //NPOI.HSSF.Record.PaletteRecord.STANDARD_PALETTE_SIZE++; colour = palette.AddColor(red, green, blue); } _colours.Add(colourName, colour); }