How set cell name for formula in HSSFDataValidation

384 Views Asked by At

i want cell value between two cells value. I use HSSFDataValidation for set validation to excel file that create by apache poi but error when execute.

source code:

HSSFDataValidationHelper dvHelper = new HSSFDataValidationHelper(sheet);
DVConstraint dvConstraint =(DVConstraint) dvHelper.createNumericConstraint
             (DataValidationConstraint.ValidationType.DECIMAL,
              DataValidationConstraint.OperatorType.BETWEEN,
              "G3", 
              "H3");
CellRangeAddressList  addressList=new CellRangeAddressList (2,rowNum,8,8);
DataValidation validation =dvHelper.createValidation(dvConstraint, addressList);
validation.setSuppressDropDownArrow(false);
validation.setShowErrorBox(true);
sheet.addValidationData(validation);

error :

The supplied text 'G3' could not be parsed as a number 
1

There are 1 best solutions below

0
On BEST ANSWER

use this format for formula: "=$G$3" and "=$H$3"