日期时间验证

//Add a DateTime Validation to column F
var val4 = worksheet.DataValidations.AddDateTimeValidation("F:F");
//For DateTime Validation, you have to set error message to true
val4.ShowErrorMessage = true;
//Minimum allowed date
val4.Formula.Value = new DateTime(2017,03,15, 01, 0,0);
//Maximum allowed date
val4.Formula2.Value= new DateTime(2017, 03, 16, 12, 0, 0);
val4.AllowBlank = true;