嗨,我想在我的apache poi中创建一列,将excel只作为数字,然后由书写代码。但是当生成excel时,它仍然接受字符串值。
private void setTemplateDatavalidationNumeric(Sheet sheet,int columnNo){
CellRangeAddressList addressList = new CellRangeAddressList(1, 20000, columnNo, columnNo);
DVConstraint constraint = DVConstraint.createNumericConstraint(DVConstraint.ValidationType.INTEGER,
DVConstraint.OperatorType.BETWEEN, "1", String.valueOf(Integer.MAX_VALUE));
DataValidation dataValidation = new HSSFDataValidation(addressList, constraint);
sheet.addValidationData(dataValidation);
}
请告诉我出什么问题了。