OpenXmlValidator not validating boolean values
See original GitHub issueBefore submitting an issue, please fill this out
Is this a:
- Issue with the OpenXml library
- Question on library usage
If you have answered that this is a question, please ask it on StackOverflow instead of here. This issue tracker is meant to track product issues while StackOverflow excels at answering questions
---------------- Remove this line and above before posting ----------------
Description
This looks like a regression. Values of type boolean, but with values 0
or 1
in the OpenXML document fail to validate.
Information
- .NET Target: .NET Core 3.1
- DocumentFormat.OpenXml Version: 2.12.0
This problem doesn’t exist in 2.11.3, hence it looks like a regression between 2.11.3 and 2.12.0.
Repro
var version = typeof(SpreadsheetDocument).Assembly.GetName().Version.ToString();
Console.WriteLine(version);
using var package = SpreadsheetDocument.Open("test.xlsx", isEditable: false);
var validator = new OpenXmlValidator();
var errors = validator.Validate(package);
if (errors.Any())
{
Console.WriteLine("This file should validate.");
Console.WriteLine();
foreach (var e in errors)
{
Console.WriteLine($"Part {e.Part.Uri}, Path {e.Path.XPath}: {e.Description}");
}
}
else
Console.WriteLine("No validation errors");
Test file: test.xlsx
Observed
OpenXmlValidator.Validate()
produces errors.
2.12.0.0 This file should validate.
Part /xl/worksheets/sheet1.xml, Path /x:worksheet[1]/x:sheetData[1]/x:row[5]/x:c[3]: Cell contents have invalid value ‘0’ for type ‘Boolean’. Part /xl/worksheets/sheet1.xml, Path /x:worksheet[1]/x:sheetData[1]/x:row[4]/x:c[3]: Cell contents have invalid value ‘0’ for type ‘Boolean’. Part /xl/worksheets/sheet1.xml, Path /x:worksheet[1]/x:sheetData[1]/x:row[3]/x:c[3]: Cell contents have invalid value ‘1’ for type ‘Boolean’.
Expected
OpenXmlValidator.Validate()
should not produce errors.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
I added a PR at https://github.com/OfficeDev/Open-XML-SDK/pull/901
Thanks! How about we get a fix for that and we’ll iterate until you have a clean test suite?