Hello all,
I am now generate a Excel with POI. I need a Dropdown list in one column,
so I use the following code.
But if the set is too large, will cause Error: "String literals in formulas
can't be bigger than 255 characters ASCII".
I read the configuration from database, and create the excel-document with
poi,
so I am not sure which column need dropdown-list, and also don't know the
set will bigger than 255 chars.
Anyone face this problem? Thanks...[?]
int EXPORT_BLANK_LINES = 50;
Collection<String> set = map.values();
// create a rectangle region. although is a column yet.
CellRangeAddressList addressList = new CellRangeAddressList(1,
EXPORT_BLANK_LINES, index, index);
DVConstraint dvConstraint =
DVConstraint.createExplicitListConstraint(set.toArray(new
String[set.size()] ));
DataValidation dataValidation = new
HSSFDataValidation(addressList, dvConstraint);
dataValidation.setSuppressDropDownArrow(false);
sheet.addValidationData(dataValidation);
Regards,
Mead