Browse Source

Styles.xml: fix default patternType when attribute is missing

master
Morten 5 years ago
committed by GitHub
parent
commit
143d33b6b5
  1. 4
      src/NPOI.OpenXmlFormats/Spreadsheet/Styles/CT_PatternFill.cs

4
src/NPOI.OpenXmlFormats/Spreadsheet/Styles/CT_PatternFill.cs

@ -50,7 +50,9 @@ namespace NPOI.OpenXmlFormats.Spreadsheet
if (node == null) if (node == null)
return null; return null;
CT_PatternFill ctObj = new CT_PatternFill(); 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); ctObj.patternType = (ST_PatternType)Enum.Parse(typeof(ST_PatternType), node.Attributes["patternType"].Value);
foreach (XmlNode childNode in node.ChildNodes) foreach (XmlNode childNode in node.ChildNodes)
{ {

Loading…
Cancel
Save