Skip to content

Commit

Permalink
Update CT_GradientStop
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyqus committed May 30, 2022
1 parent 4de4977 commit 5fdb42c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
35 changes: 32 additions & 3 deletions OpenXmlFormats/Spreadsheet/BaseTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,29 @@ public byte[] ToBytes()

public class CT_GradientStop
{
private int positionField;
private double positionField;
private CT_Color colorField;

public double position
{
get {
return positionField;
}
set { positionField = value; }
}

public CT_Color AddNewColor()
{
this.colorField = new CT_Color();
return colorField;
}

public static CT_GradientStop Parse(XmlNode node, XmlNamespaceManager namespaceManager)
{
if (node == null)
return null;
CT_GradientStop ctObj = new CT_GradientStop();
ctObj.positionField = XmlHelper.ReadInt(node.Attributes["position"]);
ctObj.positionField = XmlHelper.ReadDouble(node.Attributes["position"]);
foreach (XmlNode childNode in node.ChildNodes)
{
if (childNode.LocalName == "color")
Expand Down Expand Up @@ -133,7 +147,22 @@ internal void Write(StreamWriter sw, string nodeName)
}
sw.Write(string.Format("</{0}>", nodeName));
}

public CT_GradientStop AddNewStop()
{
var newstop = new CT_GradientStop();
if (this.stop == null)
this.stop = new List<CT_GradientStop>();
this.stop.Add(newstop);
return newstop;
}
public CT_GradientStop GetStopArray(int index)
{
if (this.stop == null)
{
return null;
}
return this.stop[index];
}
[XmlElement]
public List<CT_GradientStop> stop
{
Expand Down
9 changes: 9 additions & 0 deletions OpenXmlFormats/Spreadsheet/Styles/CT_Fill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ public CT_PatternFill AddNewPatternFill()
this.patternFillField = new CT_PatternFill();
return GetPatternFill();
}
public CT_GradientFill AddNewGradientFill()
{
this.gradientFillField = new CT_GradientFill();
return this.gradientFillField;
}
public void UnsetPatternFill()
{
this.patternFillField = null;
}
public bool IsSetPatternFill()
{
return this.patternFillField != null;
Expand Down

0 comments on commit 5fdb42c

Please sign in to comment.