Skip to content

new CellValue(bool) generates invalid XML #1070

Closed
@stevehansen

Description

@stevehansen

Description

The introduced new CellValue(bool) uses the wrong serialization causing Excel to fail to load the file.

Information

Repro

Debug.Assert(new CellValue(true).InnerText == "true");

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions