public static ExcelDataValidation Create(DataValidationType type, string address) { switch (type.Type) { case ExcelDataValidationType.TextLength: case ExcelDataValidationType.Whole: return(new DataValidationInt(address, type)); case ExcelDataValidationType.Decimal: return(new DataValidationDecimal(address, type)); case ExcelDataValidationType.List: return(new DataValidationList(address, type)); case ExcelDataValidationType.DateTime: return(new DataValidationDateTime(address, type)); case ExcelDataValidationType.Time: return(new DataValidationTime(address, type)); case ExcelDataValidationType.Custom: return(new DataValidationCustom(address, type)); default: throw new InvalidOperationException("不存在验证: " + type.Type.ToString()); } }
internal DataValidationInt(string address, DataValidationType validationType) : base(address, validationType) { Formula = new DataValidationFormulaInt(); Formula2 = new DataValidationFormulaInt(); }
internal DataValidationCustom(string address, DataValidationType validationType) : base(address, validationType) { Formula = new DataValidationFormulaCustom(); }
internal DataValidationDateTime(string address, DataValidationType validationType) : base(address, validationType) { Formula = new DataValidationFormulaDateTime(); Formula2 = new DataValidationFormulaDateTime(); }
internal DataValidationDecimal(string address, DataValidationType validationType) : base(address, validationType) { Formula = new DataValidationFormulaDecimal(); Formula2 = new DataValidationFormulaDecimal(); }