I'm running into an issue when I put a large number of items(>25) in the
data validation list. My code:
prompt = truncateString(prompt,250,true); //excel limits
to ~255
validationMsg = truncateString(validationMsg,250,true);
//excel limits to ~255
org.apache.poi.ss.util.CellRangeAddressList addressList =
new org.apache.poi.ss.util.CellRangeAddressList(firstRow, lastRow,
firstCol, lastCol);
constraint =
validationHelper.createExplicitListConstraint(valList); //BOOM
dataValidation =
validationHelper.createValidation(constraint, addressList);
dataValidation.setSuppressDropDownArrow(true);
dataValidation.createPromptBox("Valid Values", prompt);
dataValidation.setShowPromptBox(true);
dataValidation.setShowErrorBox(true);
dataValidation.setErrorStyle(DataValidation.ErrorStyle.WARNING);
dataValidation.createErrorBox("Validation Error",
validationMsg);
sheet.addValidationData(dataValidation);
When the sheet opens, I get a generic error message about a problem with
the sheet. When I click to go on, it removes the validation and opens as
normal.
I tried removing the prompt box, but the issue still occurs.
POI 3.7 on Win, jdk 1.5
Any ideas?
-Lou