我想对下拉列表中的元素使用不同的背景色。我生成了如下的下拉列表:
var list = new System.Collections.Generic.List<string>();
list.Add("okay");
list.Add("delete");
list.Add("else (Comment)");
var myDDL = string.Join(",", list.ToArray());
var celldd = (Excel.Range)mysheet.Cells[row_counter, 10];
celldd.Validation.Delete();
try
{
int type = celldd.Validation.Type;
Console.WriteLine("The validation have already been added");
}
catch (System.Runtime.InteropServices.COMException)
{
celldd.Validation.Add(
Excel.XlDVType.xlValidateList,
Excel.XlDVAlertStyle.xlValidAlertInformation,
Excel.XlFormatConditionOperator.xlBetween,
myDDL, misValue);
}
celldd.Validation.InCellDropdown = true;
celldd.Validation.IgnoreBlank = true;
celldd.Locked = false;
celldd.Value2 = "Choose";
celldd.Interior.Color = ColorTranslator.ToOle(Color.Plum);
这可能吗?到目前为止,只有默认值具有背景色。