POI導出時,將指定的列設置爲下拉列表

  本示例設置第2列爲下拉框(下拉框內容爲:是/否),從第5行開始到5657行結束。spa

關鍵代碼示例:3d

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);    

 

導出結果示例:code

相關文章
相關標籤/搜索