Summary: | Creating a data validation with prompt text longer than max leads to file failing office validation | ||
---|---|---|---|
Product: | POI | Reporter: | Morgan Hull <hullmo> |
Component: | SS Common | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | hullmo, igdevaal |
Priority: | P2 | ||
Version: | 3.13-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All |
Description
Morgan Hull
2016-03-18 14:57:12 UTC
Can you provide a unit-test or at least a code-snippet that shows how you create the invalid data validation? This would make it much easier for others to reproduce the problem. Sorry if this isn't in a reasonable format, I'm completely new to this. String promptTitle; DataValidation dataValidation; CellRangeAddressList headerCell = new CellRangeAddressList(ImportFileBundleSheets.FIRST_ROW_INDEX, ImportFileBundleSheets.FIRST_ROW_INDEX, columnNum, columnNum); DataValidationConstraint constraint = sheet.getDataValidationHelper().createCustomConstraint("A1<>\"\""); dataValidation = new HSSFDataValidation(headerCell, constraint); promptTitle = PortalServices.getI18nString(adminLocale, GroupImportConstants.PROMPT_TITLE); dataValidation.createPromptBox("Some long title that is greater than 32 characters in length", promptDescription); dataValidation.setShowErrorBox(false); sheet.addValidationData(dataValidation); Fixed via r1771254, the spec states a limit for HSSF of 32 length for title and 255 length for text. For XSSF it does not state a limit as far as I saw, but Excel imposes a 255 length limit for both title and text, so I applied this limit as well here. (In reply to Morgan Hull from comment #2) > Sorry if this isn't in a reasonable format, I'm completely new to this. It's fine to submit small, trivial changes as a comment, preferably prefixing each line with "> " so that Bugzilla doesn't text-wrap the code. If your changes get much bigger or it's ambiguous *what* you're suggesting should be changed, there's an easier way. Check out the source code using SVN [1], save your changes in the source code, then save an svn patch file ("svn diff > patch.txt" or using a graphical client). Then upload the patch file. See [2] for more info. Thanks for contributing! [1] https://poi.apache.org/subversion.html [2] https://poi.apache.org/guidelines.html#Submitting+Patches |