首页 > 代码库 > Validation.Add();Excel

Validation.Add();Excel

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;