C#:Excel条件格式-公式

Worksheet sheet = Application.ActiveSheet;

Range rng = sheet.Range[sheet.Cells[1, 1], sheet.Cells[100, 100]];
FC_SpotLight = rng.FormatConditions.Add(
	XlFormatConditionType.xlExpression,
	XlFormatConditionOperator.xlEqual, 
	"=OR(CELL(\"row\")=ROW(),CELL(\"col\")=COLUMN())"
	);
FC_SpotLight.Interior.Color = 15983837; //条件格式
FC_SpotLight.SetFirstPriority(); //设置为第一个

 

你可能感兴趣的:(C#)