带有POI 3.6的下拉列表

时间:2012-06-05 13:41:31

标签: excel drop-down-menu apache-poi

您能否建议我如何使用Excel Excel列中的POI 3.6创建下拉列表?

先谢谢。

1 个答案:

答案 0 :(得分:2)

试试这个,

{
   CellRangeAddressList addressList = 
   new CellRangeAddressList(1,10,columnIndexFromHeaderList,columnIndexFromHeaderList);
   DVConstraint dvConstraint = 
   DVConstraint.createExplicitListConstraint(stringArray);
   dataValidation = new HSSFDataValidation(addressList,dvConstraint);                      
   dataValidation.setSuppressDropDownArrow(false);
   sheet.addValidationData(dataValidation );
}