Add length validation for Excel DataValidations that are list literals.#187
Closed
leowebb wants to merge 2 commits intoapache:trunkfrom
Closed
Add length validation for Excel DataValidations that are list literals.#187leowebb wants to merge 2 commits intoapache:trunkfrom
leowebb wants to merge 2 commits intoapache:trunkfrom
Conversation
Member
|
Thanks for the contribution. Any chance you can add a sample file to the test-data/spreadsheet directory and a unit-test which verifies the added length-validation? |
Author
|
Hello! Thank you for the response. I've added a sample file that won't open in Excel, and a corresponding test that throws an exception from the DataValidation when reading from it. Hopefully this is what you were looking for - still new to the entire code base. If the test should look different, please help me find which files I should be testing against. Thanks! |
Member
|
thanks - merged with a8d90ab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
formula1literals, 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
StringPtgs 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.