Skip to content

Commit

Permalink
update chart serialization behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyqus committed Oct 9, 2021
1 parent 5e9e2a5 commit 238a078
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
15 changes: 5 additions & 10 deletions OpenXmlFormats/Drawing/Chart/Chart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1406,8 +1406,7 @@ internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<c:{0}", nodeName));
XmlHelper.WriteAttribute(sw, "val", this.val, true);
sw.Write(">");
sw.Write(string.Format("</c:{0}>", nodeName));
sw.Write("/>");
}

}
Expand Down Expand Up @@ -2342,8 +2341,7 @@ internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<c:{0}", nodeName));
XmlHelper.WriteAttribute(sw, "val", this.val);
sw.Write(">");
sw.Write(string.Format("</c:{0}>", nodeName));
sw.Write("/>");
}

[XmlAttribute]
Expand Down Expand Up @@ -2979,8 +2977,7 @@ public static CT_Scaling Parse(XmlNode node, XmlNamespaceManager namespaceManage

internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<c:{0}", nodeName));
sw.Write(">");
sw.Write(string.Format("<c:{0}>", nodeName));
if (this.logBase != null)
this.logBase.Write(sw, "logBase");
if (this.orientation != null)
Expand Down Expand Up @@ -3125,8 +3122,7 @@ internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<c:{0}", nodeName));
XmlHelper.WriteAttribute(sw, "val", this.val);
sw.Write(">");
sw.Write(string.Format("</c:{0}>", nodeName));
sw.Write("/>");
}

private double valField;
Expand Down Expand Up @@ -3176,8 +3172,7 @@ internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<c:{0}", nodeName));
XmlHelper.WriteAttribute(sw, "val", this.val.ToString());
sw.Write(">");
sw.Write(string.Format("</c:{0}>", nodeName));
sw.Write("/>");
}

[XmlAttribute]
Expand Down
6 changes: 3 additions & 3 deletions OpenXmlFormats/Spreadsheet/Sheet/CT_Row.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,23 @@ public bool IsSetHt()
{
return this.htField >=0;
}
public void unSetHt()
public void UnsetHt()
{
this.htField = -1;
}
public bool IsSetCustomHeight()
{
return this.customHeightField != false;
}
public void unSetCustomHeight()
public void UnsetCustomHeight()
{
this.customHeightField = false;
}
public bool IsSetS()
{
return this.sField != 0;
}
public void unsetHidden()
public void UnsetHidden()
{
this.hiddenField = false;
}
Expand Down
4 changes: 2 additions & 2 deletions ooxml/XSSF/UserModel/XSSFRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ public short Height
{
if (value < 0)
{
if (_row.IsSetHt()) _row.unSetHt();
if (_row.IsSetCustomHeight()) _row.unSetCustomHeight();
if (_row.IsSetHt()) _row.UnsetHt();
if (_row.IsSetCustomHeight()) _row.UnsetCustomHeight();
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions ooxml/XSSF/UserModel/XSSFSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2896,11 +2896,11 @@ private void ExpandRow(int rowNumber)
if (row.GetCTRow().outlineLevel == ((XSSFRow)GetRow(i)).GetCTRow()
.outlineLevel)
{
((XSSFRow)GetRow(i)).GetCTRow().unsetHidden();
((XSSFRow)GetRow(i)).GetCTRow().UnsetHidden();
}
else if (!IsRowGroupCollapsed(i))
{
((XSSFRow)GetRow(i)).GetCTRow().unsetHidden();
((XSSFRow)GetRow(i)).GetCTRow().UnsetHidden();
}
}
}
Expand Down Expand Up @@ -4986,7 +4986,7 @@ private static void CopyRow(XSSFSheet srcSheet, XSSFSheet destSheet, XSSFRow src
if (!srcRow.GetCTRow().IsSetCustomHeight())
{
//Copying height sets the custom height flag, but Excel will set a value for height even if it's auto-sized.
destRow.GetCTRow().unSetCustomHeight();
destRow.GetCTRow().UnsetCustomHeight();
}
destRow.Hidden = srcRow.Hidden;
destRow.Collapsed = srcRow.Collapsed;
Expand Down

0 comments on commit 238a078

Please sign in to comment.