This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other Open Source Projects and the fly likes POI - unable to create custom validation for a range of cells Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "POI - unable to create custom validation for a range of cells" Watch "POI - unable to create custom validation for a range of cells" New topic
Author

POI - unable to create custom validation for a range of cells

anish joseph
Greenhorn

Joined: May 16, 2007
Posts: 4
I need to check if the user has entered a valid number in a cells A1:A10. In Excel i would choose the cells, and then create a custom validator, and set the formula to =isNumber("$A$1:$A10") Trying do this using POI is getting me all tied in knots: Here is what i have tried:
CellRangeAddressList addressList = new CellRangeAddressList(0, 10, 0, 0);
XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper(sheet);
DataValidationConstraint customConstraint = dvHelper.createCustomConstraint("isNumber(\"$A$0:$A$10\"");
XSSFDataValidation validation = (XSSFDataValidation)dvHelper.createValidation(customConstraint, addressList);
validation.setShowErrorBox(true);
sheet.addValidationData(validation);

When i try and open this in Excel, i get an error, and Excel disables the validation

thanks in advance -anish
 
Don't get me started about those stupid light bulbs.
 
subject: POI - unable to create custom validation for a range of cells