Skip to content
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

Allow 0/1 for boolean cell values #890

Merged
merged 2 commits into from
Feb 24, 2021

Conversation

twsouthwick
Copy link
Member

Fixes #887

@twsouthwick
Copy link
Member Author

@tomjebo Can you verify that a 0 or 1 are valid boolean values for cells?

@tomjebo
Copy link
Collaborator

tomjebo commented Feb 22, 2021

From MS-OI29500 2.1.659: ...If the cell contains a Boolean, the value shall be 1 to specify true and 0 to specify false.

@twsouthwick
Copy link
Member Author

So can it be true or false as well, or only 1/0?

Base automatically changed from master to main February 22, 2021 21:11
@tomjebo
Copy link
Collaborator

tomjebo commented Feb 22, 2021

Yes, but they MUST be lower case. Excel reads this as lower case "true" or "false" but will only write as "0" or "1". Excel will throw a message dialog and ask to "correct" the underlying XML if the type is "b" and the value is anything but "0", "1", "true", or "false".

@twsouthwick
Copy link
Member Author

Thanks @mkorsukov for the comments!

@twsouthwick
Copy link
Member Author

@tomjebo can you take another look and approve if it looks good? I'd like to get this out as a 2.12.3 release

@twsouthwick twsouthwick merged commit c6cff0e into dotnet:main Feb 24, 2021
@twsouthwick twsouthwick deleted the fix-cell-validation branch February 24, 2021 20:41
twsouthwick added a commit to twsouthwick/Open-XML-SDK that referenced this pull request Feb 24, 2021
@igitur
Copy link
Contributor

igitur commented Feb 26, 2021

Yes, but they MUST be lower case. Excel reads this as lower case "true" or "false" but will only write as "0" or "1". Excel will throw a message dialog and ask to "correct" the underlying XML if the type is "b" and the value is anything but "0", "1", "true", or "false".

Thanks, this actually highlighted some issues in ClosedXML. We were writing out Boolean values using propercasing. Nobody every complained, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenXmlValidator not validating boolean values
4 participants