コード例 #1
0
        internal override XmlNode CreateXmlNode(XmlNode topNode)
        {
            TopNode = topNode;
            CreateNode("d:gradientFill");
            if (Type == ExcelFillGradientType.Path)
            {
                SetXmlNodeString(_typePath, "path");
            }
            if (!double.IsNaN(Degree))
            {
                SetXmlNodeString(_degreePath, Degree.ToString(CultureInfo.InvariantCulture));
            }
            if (GradientColor1 != null)
            {
                /*** Gradient color node 1***/
                var node     = TopNode.SelectSingleNode("d:gradientFill", NameSpaceManager);
                var stopNode = node.OwnerDocument.CreateElement("stop", ExcelPackage.schemaMain);
                stopNode.SetAttribute("position", "0");
                node.AppendChild(stopNode);
                var colorNode = node.OwnerDocument.CreateElement("color", ExcelPackage.schemaMain);
                stopNode.AppendChild(colorNode);
                GradientColor1.CreateXmlNode(colorNode);

                /*** Gradient color node 2***/
                stopNode = node.OwnerDocument.CreateElement("stop", ExcelPackage.schemaMain);
                stopNode.SetAttribute("position", "1");
                node.AppendChild(stopNode);
                colorNode = node.OwnerDocument.CreateElement("color", ExcelPackage.schemaMain);
                stopNode.AppendChild(colorNode);

                GradientColor2.CreateXmlNode(colorNode);
            }
            if (!double.IsNaN(Top))
            {
                SetXmlNodeString(_topPath, Top.ToString("F5", CultureInfo.InvariantCulture));
            }
            if (!double.IsNaN(Bottom))
            {
                SetXmlNodeString(_bottomPath, Bottom.ToString("F5", CultureInfo.InvariantCulture));
            }
            if (!double.IsNaN(Left))
            {
                SetXmlNodeString(_leftPath, Left.ToString("F5", CultureInfo.InvariantCulture));
            }
            if (!double.IsNaN(Right))
            {
                SetXmlNodeString(_rightPath, Right.ToString("F5", CultureInfo.InvariantCulture));
            }

            return(topNode);
        }
コード例 #2
0
        internal override ExcelFillXml Copy()
        {
            ExcelGradientFillXml newFill = new ExcelGradientFillXml(NameSpaceManager);

            newFill.PatternType     = base._fillPatternType;
            newFill.BackgroundColor = _backgroundColor.Copy();
            newFill.PatternColor    = _patternColor.Copy();

            newFill.GradientColor1 = GradientColor1.Copy();
            newFill.GradientColor2 = GradientColor2.Copy();
            newFill.Type           = Type;
            newFill.Degree         = Degree;
            newFill.Top            = Top;
            newFill.Bottom         = Bottom;
            newFill.Left           = Left;
            newFill.Right          = Right;

            return(newFill);
        }