Hi Everyone!

Good day!

I was wondering if it is possible to restrict the user from inputting an alphabet character in a cell via Apache POI.

I tried the following code but the cell is still accepting an alphabet character. (Reference: Busy Developer)

|XSSFDataValidationHelper  dvHelper=  new  
XSSFDataValidationHelper(destinationSheet);
XSSFDataValidationConstraint  dvConstraint=  (XSSFDataValidationConstraint)  
dvHelper.createIntegerConstraint(OperatorType.GREATER_THAN,  "0",  "0");
CellRangeAddressList  addressList=  new  
CellRangeAddressList(7,destinationSheet.getLastRowNum()  +  1,  9,  
destinationSheet.getRow(0).getLastCellNum());
XSSFDataValidation  validation=  (XSSFDataValidation)  
dvHelper.createValidation(dvConstraint,  addressList);

validation.setErrorStyle(ErrorStyle.STOP);
validation.createErrorBox("Error",  "Only numeric values are allowed");

destinationSheet.addValidationData(validation);
|


--
*Michael Ardan*
Jr Analyst/Developer
*eScience Corporation*
Tel (632) 8501324
Fax (632) 8427408
Mobile (63) 926-3145737
YM [email protected]

/This e-mail message (including attachments, if any) is intended for the use of the individual or the entity to whom it is addressed and may contain information that is privileged, proprietary, confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender and delete this E-mail message immediately./

Reply via email to