In my MVC project I'm using SpreadsheetGear to generate an excel document. I've got a column that has a validation rule against it that only allows the user to select from the following options: A,B,C,D. I need to be able to set different background colours for each of the options. For example:
- A - Green
- B - Yellow
- C - Orange
- D - Red
I've arrived to this error when running the code:
Maximum number of FormatConditions already exists.
My code is as follows:
conditions.Add(FormatConditionType.CellValue, FormatConditionOperator.Equal, "A", null).Interior.Color = Color.LightGreen;
conditions.Add(FormatConditionType.CellValue, FormatConditionOperator.Equal, "B", null).Interior.Color = Color.Yellow;
conditions.Add(FormatConditionType.CellValue, FormatConditionOperator.Equal, "C", null).Interior.Color = Color.Orange;
conditions.Add(FormatConditionType.CellValue, FormatConditionOperator.Equal, "D", null).Interior.Color = Color.Red;
It seems that 3 is the maximum amount of Format conditions you can have for a cell. Is there anyway around this limitation?