EPPlus
EPPlus copied to clipboard
ConditionalFormatting Issue
Hi there, OfficeOpenXml.ConditionalFormatting.Contracts.IExcelConditionalFormattingRule format1 = sheet2.ConditionalFormatting.ElementAt(0); var test = format1.Node.ParentNode; I've recently upgraded from EpPlus version 5.0 to 7.0 and noticed that the IExcelConditionalFormattingRule.Node property has been removed from the ConditionalFormattingRule. Previously, I was using IExcelConditionalFormattingRule.Node.ParentNode to access certain functionalities. Could you kindly suggest an alternative approach or solution for this issue? Thank you.
Conditional formattings are kept in memory from EPPlus 7 to get better performance, so the access to the XML DOM has been removed. If you are missing any functionality please let us know.
Hi,
I am using this code using (var package = new ExcelPackage(newFile)) { ExcelWorksheet sheet1 = package.Workbook.Worksheets["Sheet1"]; OfficeOpenXml.ConditionalFormatting.Contracts.IExcelConditionalFormattingRule oldConditionalFormattingRule = sheet1.ConditionalFormatting.First(); X14CondtionalFormattingRule x14ConditionalFormattingRule = sheet1.X14ConditionalFormatting.X14Rules.First(); OfficeOpenXml.ConditionalFormatting.Contracts.IExcelConditionalFormattingRule format1 = sheet2.ConditionalFormatting.ElementAt(0); OfficeOpenXml.ConditionalFormatting.Contracts.IExcelConditionalFormattingRule format2 = sheet2.ConditionalFormatting.ElementAt(1); Assert.AreNotEqual(format1.Node.ParentNode, format2.Node.ParentNode); }
Looks like you're trying to determine if a certain Conditional Formatting is part of the x14 namespace or what we call a Conditional Formatting with extLst.
Any particular reason for this? We made significant changes to conditional formatting so that we can support the reading and writing of all conditional formatting types without the user having to do any extra work. The "Node" property was removed as all the data is now held in different properties in memory. Comparing some of those instead might be more appropriate.
Hi, got you, but is there any chance I can get the Node, like is there any other way to get this?
Unfortunately no. We now essentially read in the data and only leave a placeholder node in the file until we write to it.
Why do you need the node? Only thing I can come to think of is to determine if it's an ExtLst ConditionalFormatting or not but a user shouldn't really have to worry about that. We do have internal properties that identify it however.
Closed due to inactivity