Closed dlineg4 closed 8 months ago
Appreciate your comments.
Currently the library's data validation functionality only supports "lists", i.e. drop-downs of valid items.
But POI does allow other types of constraint including dates so this could be an enhancement.
@dlineg4 I'm assuming you mean something like this:
validation = s.newDataValidation()
.onCells( cellRange )
.withMinDate( ParseDateTime( "1 January 2023" ) )
.withMaxDate( ParseDateTime( "31 December 2023" ) )
.withErrorMessage( "Please enter a date in 2023" )
.addToWorkbook( workbook );
Could you confirm this is what you have in mind?
@cfsimplicity Yeah, that would be pretty great. For other future validations (like Decimals and Whole Numbers, etc) would you predict that it would follow a similar format for you proposal for Dates? For example something like this?
validation = s.newDataValidation()
.onCells( cellRange )
.withMinWholeNumber( 0 )
.withMaxWholeNumber( 50000 )
.withErrorMessage( "Please enter a number between 0 and 50000" )
.addToWorkbook( workbook );
Thanks.
POI does support all of those types and I did envisage adding others in due course. I'll probably only add dates and numbers for now though.
I think I'd use "Integer" rather than "Whole number" - more appropriate in a programming context I think.
Dates would be much appreciated.
Thanks again. I'll keep on the lookout.
First off. Thank you. This library is fantastic.
The addition of the newDataValidation/addDataValidation is fantastic. I'm curious is there a way to do Date Validation of a cell?
Thanks.