You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by anishjoseph <jo...@gmail.com> on 2013/03/15 08:35:13 UTC

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

I need to check if the user has entered a valid number in say 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



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/POI-unable-to-create-custom-validation-for-a-range-of-cells-tp5712350.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org