This project has moved and is read-only. For the latest updates, please go here.

No color palette class in EPPlus?

Feb 4, 2013 at 7:39 AM

I was trying to access the color palette of the excel workbook, and realized that there isn't one in EPPlus. Is there plan on implementing this?

Thank you for your fantastic work!
Feb 4, 2013 at 8:19 AM
Edited Feb 4, 2013 at 8:28 AM
Since Excel 2007 spreadsheets can support the full Windows RGB 16.7 million color palate. Add a reference to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Drawing.dll. And add using System.Drawing to your code file.

Here is an example for setting a color:

excel_worksheet_1.Cells["A1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
excel_worksheet_1.Cells["A1"].Style.Fill.BackgroundColor.SetColor(Color.FromArgb(79, 129, 189));

If you see a particular color you want press the "PRINT SCRN" key then open the Windows paint program (type mspaint {enter} from the Run prompt). Paste\CTRL+V the snapshot of your windows desktop into paint then select the color picker tool, click on a color you want from the pasted image, 'Color 1' should change to the picked color, then click 'Edit colors', The chosen color will be selected with its respective Red, Green, Blue values.
Feb 4, 2013 at 10:04 AM
How if we want
  • to use a particular color from the palette?
    Say, color at 20th index in palette?
  • check if the used color is a color from palette?
    Say, to check if Color.FromArgb(79, 129, 189) is a color in palette?
Any idea how to achieve these using EPPlus?