导航

Validation.Add();Excel

Posted on 2014-05-24 21:54  Trible.H  阅读(835)  评论(0编辑  收藏  举报

Irange = (Microsoft.Office.Interop.Excel.Range)worksheet.get_Range("I1", "I1").get_Resize(100, 1);

//获取一整列I,行数为100


Irange.Validation.Add(Microsoft.Office.Interop.Excel.XlDVType.xlValidateList, Microsoft.Office.Interop.Excel.XlDVAlertStyle.xlValidAlertStop, Microsoft.Office.Interop.Excel.XlFormatConditionOperator.xlBetween, ConfigurationSettings.AppSettings["ContractType"].ToString(), Type.Missing);

Irange.Validation.InCellDropdown = true;