示例#1
0
        /// <summary>
        /// Adds a <c>spPr</c> node (Shape properties) to the node of type <c>ser</c> (Area Chart Series) specified. Not supported in <c>EPPlus</c> library.
        /// </summary>
        /// <param name="node"><c>ser</c> node (Area Chart Series).</param>
        /// <param name="model">Serie from model.</param>
        /// <param name="documentHelper">Target xml document helper.</param>
        /// <remarks>
        /// For more information please see <a href="http://www.schemacentral.com/sc/ooxml/e-draw-chart_spPr-1.html">http://www.schemacentral.com/sc/ooxml/e-draw-chart_spPr-1.html</a>
        /// </remarks>
        /// <exception cref="T:System.ArgumentNullException">If <paramref name="node" /> is <c>null</c>.</exception>
        /// <exception cref="T:System.ArgumentNullException">If <paramref name="model" /> is <c>null</c>.</exception>
        public static void AddShapePropertiesNode(this XmlNode node, XlsxChartSerie model, IXmlHelper documentHelper)
        {
            SentinelHelper.ArgumentNull(node, nameof(node));
            SentinelHelper.ArgumentNull(model, nameof(model));

            var shapePropertiesNode = documentHelper.CreateOrDefaultAndAppendElementToNode(node, "c:spPr");

            shapePropertiesNode.AddSolidFillNode(model.GetColor(), documentHelper);
        }
示例#2
0
        private void AddColorToSerie(XlsxChartSerie serie)
        {
            var xmlSerieList = XmlWriter.GetElementsByTagName("c:v");
            var textNode = xmlSerieList.FirstOrDefault(n => n.ParentNode.ParentNode.Name.Equals("ser") && n.InnerText.Equals(serie.Name));
            if (textNode == null)
            {
                return;
            }

            var charType = serie.ChartType;
            switch (charType)
            {
                case ChartType.Pie3D:
                    break;

                default:
                    var areaChartSeriesNode = textNode.ParentNode.ParentNode;
                    areaChartSeriesNode.AddShapePropertiesNode(serie, XmlWriter);
                    break;
            }
        }