111,126
社区成员
发帖
与我相关
我的任务
分享
Range current_rang = ListKey.Range;//excel自生的控件List
object mis = System.Type.Missing;
int count = current_rang.CurrentRegion.Rows.Count;
Range selectionrange = current_rang.get_Range((Excel.Range)current_rang.Cells[7, 2], (Excel.Range)current_rang.Cells[count, 4]);
//selectionrange.FormatConditions.Delete();
Excel.FormatCondition cond =
(Excel.FormatCondition)selectionrange.FormatConditions.Add(Excel.XlFormatConditionType.xlExpression,
Excel.XlFormatConditionOperator.xlLessEqual, "=SUMPRODUCT(($B$7:$B$" + (count + 5).ToString() + "=$B7)*($C$7:$C$" + (count +5).ToString() + "=$C7)*($D$7:$D$" + (count + 5).ToString() + "=$D7))>1",
mis, mis, mis, mis, mis);//添加条件选择规则
//规则成立后的格式设定
cond.Interior.PatternColorIndex = Excel.Constants.xlAutomatic;
cond.Interior.TintAndShade = 0;
cond.Interior.Color = 10066431;
cond.AppliesTo. 《-----这里应该是条件选择中的应用于,这里代码不清楚怎么写。。。请指教
cond.StopIfTrue = false;