-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for #2224 #2225
Fix for #2224 #2225
Conversation
…utMessage, showErrorMessage in XLSX reader (was a loose comparison of SimpleXML object to integer), flag values may also be string true/false not just 0/1. filter_var( $flag, FILTER_VALIDATE_BOOLEAN) chosen to handle both 0/1 and true/false values in the file being read. * Fix writing data validation flag showDropDown (Inverted logic in reader was replicated to Writer)
Are you able to add some unit tests to show that files which do have true/false rather than 1/0 are handled correctly? |
OK, I shall attempt a unit test for this PR. The true/false values are in xlsx documents created or edited in LibreOffice. This is valid under the schema definition https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.datavalidation?view=openxml-2.8.1
And based on https://www.w3.org/TR/xmlschema-2/#boolean
|
… is apparently incorrect documentation, it works as hideDropDrop if true.
…ion boolean values and those with 1/0 (Excel, GoogleSheets)
Unit tests added with both DataValidation defined with true/false and also 1/0 I've reverted the change to showDropDown as upon further investigation this flag is misdefined in the specification and acts as a hideDropDown, which is the reason behind the inversion in both Reader and Writer. I have instead added a brief comment on the relevant lines when it is read and written. |
Thank you for your contribution, and for the excellent documentation of what you've done. |
Fixes #2224 Fix reading data validation flags allowBlank, showDropDown, showInputMessage, showErrorMessage in XLSX reader (was a loose comparison of SimpleXML object to integer), flag values may also be string true/false not just 0/1.
filter_var( $flag, FILTER_VALIDATE_BOOLEAN) chosen to handle both 0/1 and true/false values in the file being read.
This is:
Checklist:
Why this change is needed?
Data validation flags are lost when reading an XLSX file containing true/false boolean values and writing it out after editing.