diff --git a/OpenXmlFormats/Spreadsheet/BaseTypes.cs b/OpenXmlFormats/Spreadsheet/BaseTypes.cs index ebe7a34e3..97b874554 100644 --- a/OpenXmlFormats/Spreadsheet/BaseTypes.cs +++ b/OpenXmlFormats/Spreadsheet/BaseTypes.cs @@ -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") @@ -133,7 +147,22 @@ internal void Write(StreamWriter sw, string nodeName) } sw.Write(string.Format("", nodeName)); } - + public CT_GradientStop AddNewStop() + { + var newstop = new CT_GradientStop(); + if (this.stop == null) + this.stop = new List(); + 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 stop { diff --git a/OpenXmlFormats/Spreadsheet/Styles/CT_Fill.cs b/OpenXmlFormats/Spreadsheet/Styles/CT_Fill.cs index 7cc220b61..cd44f227f 100644 --- a/OpenXmlFormats/Spreadsheet/Styles/CT_Fill.cs +++ b/OpenXmlFormats/Spreadsheet/Styles/CT_Fill.cs @@ -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;