Add length validation for Excel DataValidations that are list literals. #187
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I am not entirely sure if this is a bug, but as I was writing some code to produce a list literal for data validations, I was running into an issue where when I was producing an xlsx, I was unable to open the file in Microsoft Excel due to what I eventually understood to be a hard limit on the size of the data validation literal, which was 255 characters (including separators, excluding quotes). I spoke with a maintainer on IRC about whether this was an issue or not, and he advised that I double check the specifications for OOXML documents. I wasn't able to find anything about limiting the size of
formula1
literals, but sure enough if one manually edits the file XML and then opens it in Excel, the user will be presented with an error saying that the file cannot be read by Excel due to some error.The reason I'm not sure for whether or not is is a bug is due to the specification seemingly being right (these files open just fine in OpenOffice/LibreOffice), but Excel seems to ignore this for whatever reason.
For wholeness, I also checked in the HSSF code, and this limit is enforced there (specifically
StringPtg
s have a hard limit of 255 ASCII characters, and that is what is used when creating the Data Validations).Otherwise, assuming this is a bug because Excel cannot open the file but the software still generates the file, then here is a PR to hopefully fix the issue.
Thanks.