在我的项目中,我有代码根据单元格值条件格式化单元格的背景颜色,如下所示:
//if value is 1 than colorIndex is 3;
Excel.FormatCondition condition = colorRange.FormatConditions.Add(
Type: Excel.XlFormatConditionType.xlTextString,
Operator: Excel.XlFormatConditionOperator.xlEqual,
Formula1: "=1");
condition5.Interior.ColorIndex = 3;
此条件工作正常,但以下代码中的条件不起作用:
//if value is Red Color than colorIndex is 3;
Excel.FormatCondition condition = colorRange.FormatConditions.Add(
Type: Excel.XlFormatConditionType.xlTextString,
Operator: Excel.XlFormatConditionOperator.xlEqual,
Formula1: "=Red Color");
condition5.Interior.ColorIndex = 3;
我收到的错误消息是“参数不正确”
我究竟做错了什么?