Exemplo n.º 1
0
 internal protected override ExcelChartTitle GetTitle()
 {
     if (_title == null)
     {
         AddTitleNode();
         _title = new ExcelChartTitle(_chart, NameSpaceManager, TopNode, "c");
     }
     return(_title);
 }
Exemplo n.º 2
0
        internal protected XmlNode AddTitleNode()
        {
            var node = TopNode.SelectSingleNode($"{_nsPrefix}:title", NameSpaceManager);

            if (node == null)
            {
                node = CreateNode($"{_nsPrefix}:title");
                if (_chart._isChartEx == false)
                {
                    node.InnerXml = ExcelChartTitle.GetInitXml(_nsPrefix);
                }
            }
            return(node);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Fills a <see cref="OfficeOpenXml.Drawing.Chart.ExcelChartTitle"/> object with model data.
        /// </summary>
        /// <param name="title"><see cref="OfficeOpenXml.Drawing.Chart.ExcelChartTitle"/> object.</param>
        /// <param name="element">A <see cref="KnownChartElement" /> value.</param>
        /// <param name="model">Chart title model definition.</param>
        private static void FormatFromModel(this ExcelChartTitle title, KnownChartElement element, ChartTitleModel model)
        {
            if (model.Show == YesNo.No)
            {
                return;
            }

            if (!string.IsNullOrEmpty(model.Text))
            {
                title.Text = model.Text;
                title.Font.SetFromFont(model.Font.ToFont());
                title.Font.Color = model.Font.GetColor();

                title.Rotation     = model.Orientation.ToAngle();
                title.TextVertical = model.Orientation == KnownAxisOrientation.Vertical ? eTextVerticalType.WordArtVertical : eTextVerticalType.Horizontal;
            }

            title.Border.FormatFromModel(element, model.Border);
        }