isEmptyCellAllowed property
Gets or sets the isEmptyCellAllowed.
//Creating one worksheet and accessing the first sheet
final Workbook workbook = Workbook(1);
final Worksheet sheet = workbook.worksheets[0];
//Accessing the first cell in worksheet and applying the textLength with promptBox property
final DataValidation textLengthValidation =
sheet.getRangeByName('A1').dataValidation;
//sets the allowType
textLengthValidation.allowType = ExcelDataValidationType.textLength;
//sets the comparisonOperator
textLengthValidation.comparisonOperator =
ExcelDataValidationComparisonOperator.between;
//sets the firstFormula
textLengthValidation.firstFormula = '1';
//sets the second Formula
textLengthValidation.secondFormula = '5';
//sets the promptBoxVPosition
textLengthValidation.promptBoxVPosition = 50;
//sets the promptBoxHPosition
textLengthValidation.promptBoxHPosition = 50;
//sets the isPromptBoxPositionFixed
textLengthValidation.isPromptBoxPositionFixed = true;
//sets the isSuppressDropDownArrow
textLengthValidation.isSuppressDropDownArrow = true;
//sets the isEmptyCellAllowed
textLengthValidation.isEmptyCellAllowed = false;
//Save and dispose Workbook
final List<int> bytes = workbook.saveAsStream();
saveAsExcel(bytes, 'ExceltextLengthValidationpromptBox.xlsx');
workbook.dispose();
Implementation
late bool isEmptyCellAllowed;