From 143d33b6b5b4f2920a4b3787a8d794f9a692b627 Mon Sep 17 00:00:00 2001 From: Morten Date: Fri, 30 Aug 2019 13:04:37 +0200 Subject: [PATCH] Styles.xml: fix default patternType when attribute is missing --- src/NPOI.OpenXmlFormats/Spreadsheet/Styles/CT_PatternFill.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/NPOI.OpenXmlFormats/Spreadsheet/Styles/CT_PatternFill.cs b/src/NPOI.OpenXmlFormats/Spreadsheet/Styles/CT_PatternFill.cs index d199cff..487c9c7 100644 --- a/src/NPOI.OpenXmlFormats/Spreadsheet/Styles/CT_PatternFill.cs +++ b/src/NPOI.OpenXmlFormats/Spreadsheet/Styles/CT_PatternFill.cs @@ -50,7 +50,9 @@ namespace NPOI.OpenXmlFormats.Spreadsheet if (node == null) return null; CT_PatternFill ctObj = new CT_PatternFill(); - if (node.Attributes["patternType"] != null) + if (node.Attributes["patternType"] == null) + ctObj.patternType = ST_PatternType.solid; + else ctObj.patternType = (ST_PatternType)Enum.Parse(typeof(ST_PatternType), node.Attributes["patternType"].Value); foreach (XmlNode childNode in node.ChildNodes) {