Hi,
I have a problem with the colortable of excel. If I set a color of a WorksheetCell e.g.:
cell.CellFormat.FillPatternForegroundColor = Color.FromArgb(232, 232, 232);
the colortable of excel will be changed so that a default color is replaced by this defined color.
Can anybody help me?
Sorry about the formatting ...
#region Excel Colors public static Color[ ] ExcelColors = new Color[ ] { ColorFromArgb(0, 0, 0), ColorFromArgb(255, 255, 255), ColorFromArgb(255, 0, 0), ColorFromArgb(0, 255, 0), ColorFromArgb(0, 0, 255), ColorFromArgb(255, 255, 0), ColorFromArgb(255, 0, 255), ColorFromArgb(0, 255, 255), ColorFromArgb(128, 0, 0), ColorFromArgb(0, 128, 0), ColorFromArgb(0, 0, 128), ColorFromArgb(128, 128, 0), ColorFromArgb(128, 0, 128), ColorFromArgb(0, 128, 128), ColorFromArgb(192, 192, 192), ColorFromArgb(128, 128, 128), ColorFromArgb(153, 153, 255), ColorFromArgb(153, 51, 102), ColorFromArgb(255, 255, 204), ColorFromArgb(204, 255, 255), ColorFromArgb(102, 0, 102), ColorFromArgb(255, 128, 128), ColorFromArgb(0, 102, 204), ColorFromArgb(204, 204, 255), ColorFromArgb(0, 0, 128), ColorFromArgb(255, 0, 255), ColorFromArgb(255, 255, 0), ColorFromArgb(0, 255, 255), ColorFromArgb(128, 0, 128), ColorFromArgb(128, 0, 0), ColorFromArgb(0, 128, 128), ColorFromArgb(0, 0, 255), ColorFromArgb(0, 204, 255), ColorFromArgb(204, 255, 255), ColorFromArgb(204, 255, 204), ColorFromArgb(255, 255, 153), ColorFromArgb(153, 204, 255), ColorFromArgb(255, 153, 204), ColorFromArgb(204, 153, 255), ColorFromArgb(255, 204, 153), ColorFromArgb(51, 102, 255), ColorFromArgb(51, 204, 204), ColorFromArgb(153, 204, 0), ColorFromArgb(255, 204, 0), ColorFromArgb(255, 153, 0), ColorFromArgb(255, 102, 0), ColorFromArgb(102, 102, 153), ColorFromArgb(150, 150, 150), ColorFromArgb(0, 51, 102), ColorFromArgb(51, 153, 102), ColorFromArgb(0, 51, 0), ColorFromArgb(51, 51, 0), ColorFromArgb(153, 51, 0), ColorFromArgb(153, 51, 102), ColorFromArgb(51, 51, 153), ColorFromArgb(51, 51, 51) };
public static int[,] ExcelPallete = new int[,] { { 0, 52, 51, 50, 48, 10, 54, 55 }, { 8, 45, 11, 9, 13, 4, 46, 15 }, { 2, 44, 42, 49, 41, 40, 12, 47 }, { 6, 43, 5, 3, 7, 32, 53, 14 }, { 37, 39, 35, 34, 33, 36, 38, 1 }, { 16, 17, 18, 19, 20, 21, 22, 23 }, { 24, 25, 26, 27, 28, 29, 30, 31 } }; #endregion
public static Color ExcelColor(int row, int col) { return ExcelColors[ExcelPallete[row, col]]; }
public static Color ColorFromArgb(int r, int g, int b) { return Color.FromArgb(((System.Byte)(r)), ((System.Byte)(g)), ((System.Byte)(b))); }
This might work for you:
Unfortunately there is no good way to do this.
Ok, I have sended a Support Issue. Thanks.
Maybe there is another way to use directly the colors of the default excel colortable?
e.g.:
cell.CellFormat.FillPatternForegroundColor = Infragistics.Excel.Color.Color5;
Is there a way to do something like this?
This is a bug. I would recommend submitting it to the support group: http://devcenter.infragistics.com/Protected/SubmitSupportIssue.Aspx.