Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IRange Interface : DataValidation Property

DataValidation Property

Gets a IDataValidation object that represents the data validation associated with the cell. Read-only.
Syntax
'Declaration
 
ReadOnly Property DataValidation As IDataValidation
'Usage
 
Dim instance As IRange
Dim value As IDataValidation
 
value = instance.DataValidation
IDataValidation DataValidation {get;}
Example
The following code illustrates how to access DataValidation property of the Range.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
            
IWorksheet sheet = workbook.Worksheets[0];
            
//Data validation for number
IDataValidation validation = sheet.Range["A3"].DataValidation;
validation.AllowType = ExcelDataType.Integer;
            
//Value between 0 to 10
validation.CompareOperator = ExcelDataValidationComparisonOperator.Between;
validation.FirstFormula = "0";
validation.SecondFormula = "10";
            
workbook.SaveAs("DataValidation.xlsx");
workbook.Close();
excelEngine.Dispose();
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also