comparisonOperator property
Gets or sets the comparisonOperator.
//Creating one worksheet and accessing the first sheet
final Workbook workbook = Workbook(1);
final Worksheet sheet = workbook.worksheets[0];
//Accessing the first cell in excel-sheet and applying the textLength with Between property
final DataValidation textLengthValidation =
sheet.getRangeByName('A1').dataValidation;
//sets the allowType
textLengthValidation.allowType = ExcelDataValidationType.textLength;
//sets the comparisonOperator
textLengthValidation.comparisonOperator =
ExcelDataValidationComparisonOperator.between;
//sets the first formula
textLengthValidation.firstFormula = '1';
//sets the second formula
textLengthValidation.secondFormula = '5';
//sets the errorbox text
textLengthValidation.errorBoxText =
'Text length should be between 1 and 5';
//sets the errorbox title
textLengthValidation.errorBoxTitle = 'ERROR';
//sets the promptBox title
textLengthValidation.promptBoxTitle = 'TextLength';
//sets the promptbox text
textLengthValidation.promptBoxText = 'Data validation for text length';
//sets the promptBoxVisibility
textLengthValidation.showPromptBox = true;
//sets the errorStyle
textLengthValidation.errorStyle = ExcelDataValidationErrorStyle.warning;
//Save and dispose Workbook
final List<int> bytes = workbook.saveAsStream();
saveAsExcel(bytes, 'ExceltextLengthValidationbetween.xlsx');
workbook.dispose();
Implementation
late ExcelDataValidationComparisonOperator comparisonOperator;