I am using this file valid.xlsx.zip (20.6 KB)
;
The validation in cell A1 has 3 values John, Jane, Joe
But when I am using this code:
Worksheet sheet = book.getWorksheets().get("Sheet1");
Cells cells = sheet.getCells();
Cell a1 = cells.get("a1");
if(a1.getValidationValue()) {
System.out.println("Value "+a1.getDisplayStringValue()+" is valid");
} else {
System.out.println("Value "+a1.getDisplayStringValue()+" is NOT valid");
}
a1.setValue("Jane");
if(a1.getValidationValue()) {
System.out.println("Value "+a1.getDisplayStringValue()+" is valid");
} else {
System.out.println("Value "+a1.getDisplayStringValue()+" is NOT valid");
}
a1.setValue("Joe");
if(a1.getValidationValue()) {
System.out.println("Value "+a1.getDisplayStringValue()+" is valid");
} else {
System.out.println("Value "+a1.getDisplayStringValue()+" is NOT valid");
}
The output I get is
Value John is valid
Value Jane is NOT valid
Value Joe is NOT valid
This output is completely unexpected. Can you please look into this?