Skip to content

Commit

Permalink
Fix #1412
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyqus committed Sep 22, 2024
1 parent 00a0934 commit 97c974c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions OpenXmlFormats/Spreadsheet/Styles/CT_NumFmt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public static CT_NumFmt Parse(XmlNode node, XmlNamespaceManager namespaceManager
return null;
CT_NumFmt ctObj = new CT_NumFmt();
ctObj.numFmtId = XmlHelper.ReadUInt(node.Attributes["numFmtId"]);
ctObj.formatCode = XmlHelper.ReadString(node.Attributes["formatCode"]);
if(node.Attributes["formatCode"]!=null)
ctObj.formatCode = XmlHelper.ReadString(node.Attributes["formatCode"]);
return ctObj;
}

Expand All @@ -33,7 +34,8 @@ internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<{0}", nodeName));
XmlHelper.WriteAttribute(sw, "numFmtId", this.numFmtId,true);
XmlHelper.WriteAttribute(sw, "formatCode", this.formatCode);
if(formatCode!=null)
XmlHelper.WriteAttribute(sw, "formatCode", this.formatCode, true);
sw.Write("/>");
}

Expand Down

0 comments on commit 97c974c

Please sign in to comment.