From 0d8ccb1ad8928f94edbe3d7938e361a25d75cb78 Mon Sep 17 00:00:00 2001 From: Hasan Baidoun Date: Fri, 10 May 2019 12:04:15 +0300 Subject: [PATCH] _color being null if border tag is empty Hi, In a DevExpress generated excel file, there might be border tags in the style that have no content. Reading like this: In which case an exception will be thrown. The solution is to check for the Exists property before trying to copy the color. Regards, --- EPPlus/Style/XmlAccess/ExcelBorderItemXml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EPPlus/Style/XmlAccess/ExcelBorderItemXml.cs b/EPPlus/Style/XmlAccess/ExcelBorderItemXml.cs index 7bc4aceab..7eea04b3a 100644 --- a/EPPlus/Style/XmlAccess/ExcelBorderItemXml.cs +++ b/EPPlus/Style/XmlAccess/ExcelBorderItemXml.cs @@ -127,7 +127,7 @@ internal ExcelBorderItemXml Copy() { ExcelBorderItemXml borderItem = new ExcelBorderItemXml(NameSpaceManager); borderItem.Style = _borderStyle; - borderItem.Color = _color.Copy(); + borderItem.Color = Exists ? _color.Copy() : null; return borderItem; }