-
Notifications
You must be signed in to change notification settings - Fork 551
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
new CellValue(bool) generates invalid XML #1070
Comments
The validator uses the .NET bool.TryParse which allows both "True" and "true" so isn't exactly correct. |
@tomjebo can you verify this from the spec side? I'm good taking a fix for this, just want to verify the spec |
@tomjebo I merged this in. Please let me know if there's any issue with the spec. |
@twsouthwick @stevehansen thanks for getting this in. Our implementer notes and 29500 are not explicit on the case.
The W3C spec has this: [Definition:] boolean has the ·value space· required to support the mathematical concept of binary-valued logic: {true, false}.
3.2.2.1 Lexical representation
An instance of a datatype that is defined as ·boolean· can have the following legal literals {true, false, 1, 0}.
3.2.2.2 Canonical representation
The canonical representation for boolean is the set of literals {true, false}.
3.2.2.3 Constraining facets
boolean has the following ·constraining facets·:
pattern
whiteSpace Note the "legal literals". |
Description
The introduced new CellValue(bool) uses the wrong serialization causing Excel to fail to load the file.
Information
Repro
Observed
Spec expects the boolean values to be "true" or "false" but the code is using bool.ToString() which returns "True" or "False".
https://github.com/OfficeDev/Open-XML-SDK/blob/main/src/DocumentFormat.OpenXml/Spreadsheet/CellValue.cs#L42
Expected
Per .NET remarks for the boolean.ToString:
This method returns the constants "True" or "False".
Note that XML is case-sensitive, and that the XML specification recognizes "true" and "false" as the valid set of Boolean values. If the string returned by the ToString() method is to be written to an XML file, its String.ToLowerInvariant method should be called first to convert it to lowercase.
The text was updated successfully, but these errors were encountered: