EPPlus icon indicating copy to clipboard operation
EPPlus copied to clipboard

Bug: CustomDocumentProperties (possibly document properties in general) are case-sensitive

Open Tobriand opened this issue 6 years ago • 0 comments

Within the Excel Application, CustomDocumentProperties are not case sensitive. EPPlus though treats them as such.

Failing test(s):

[TestMethod]
        public void EPPHasCaseInsensitiveProperties()
        {
            var package = new OfficeOpenXml.ExcelPackage();
            package.Workbook.Properties.SetCustomPropertyValue("Foo", "Bar");
            bool fail1 = false, fail2  =false, fail3 = false;
            try
            {
                // MS Excel will throw an exception here in the VBE
                package.Workbook.Properties.SetCustomPropertyValue("foo", "bar");
                fail1 = true;
            }
            catch { }


            var foo1 = package.Workbook.Properties.GetCustomPropertyValue("Foo");
            var foo2 = package.Workbook.Properties.GetCustomPropertyValue("foo");
            if (foo1 != foo2)
                fail2 = true;


            // Excel will find the property
            try
            {
                var foo3 = package.Workbook.Properties.GetCustomPropertyValue("fOO");
                fail3 = foo3 == null;
            }
            catch { fail3 = true; }

            Assert.IsFalse(fail1);
            Assert.IsFalse(fail2);
            Assert.IsFalse(fail3);
        }

Tobriand avatar Nov 07 '19 14:11 Tobriand