本示例设置第2列为下拉框(下拉框内容为:是/否),从第5行开始到5657行结束。
关键代码示例:
1 ComboxList = new String[]{"是","否"}; 2 HSSFWorkbook wbook = new HSSFWorkbook(); 3 CellRangeAddressList regions = new CellRangeAddressList(4,5656,colNum,colNum); 4 DVConstraint constraint = DVConstraint.createExplicitListConstraint(ComboxList); 5 HSSFDataValidation data_validation = new HSSFDataValidation(regions,constraint); 6 wbook.getSheetAt(0).addValidationData(data_validation);
导出结果示例: