Example #1
0
        /**
         * Returns the title, or null if none is Set
         */
        public XSSFRichTextString GetTitle()
        {
            if (!chart.IsSetTitle())
            {
                return(null);
            }

            // TODO Do properly
            CT_Title title = chart.title;

            StringBuilder text = new StringBuilder();

            //XmlObject[] t = title
            //    .selectPath("declare namespace a='"+XSSFDrawing.NAMESPACE_A+"' .//a:t");
            for (int m = 0; m < t.Length; m++)
            {
                NodeList kids = t[m].GetDomNode().GetChildNodes();
                for (int n = 0; n < kids.GetLength(); n++)
                {
                    if (kids.item(n) is Text)
                    {
                        text.Append(kids.item(n).GetNodeValue());
                    }
                }
            }

            return(new XSSFRichTextString(text.ToString()));
        }
Example #2
0
        public XSSFRichTextString GetTitle()
        {
            if (!this.chart.IsSetTitle())
            {
                return((XSSFRichTextString)null);
            }
            CT_Title      title = this.chart.title;
            StringBuilder sb    = new StringBuilder();

            new XmlSerializer(typeof(CT_Title)).Serialize((TextWriter) new StringWriter(sb), (object)title);
            string      xml         = sb.ToString();
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xml);
            sb.Length = 0;
            sb.Append(xmlDocument.InnerText);
            return(new XSSFRichTextString(sb.ToString()));
        }
Example #3
0
        /**
         * Returns the title, or null if none is Set
         */
        public XSSFRichTextString GetTitle()
        {
            if (!chart.IsSetTitle())
            {
                return(null);
            }

            // TODO Do properly
            CT_Title title = chart.title;

            StringBuilder text = new StringBuilder();
            XmlSerializer sr   = new XmlSerializer(typeof(CT_Title));
            StringWriter  sw   = new StringWriter(text);

            sr.Serialize(sw, title);
            //XmlObject[] t = title
            //    .selectPath("declare namespace a='"+XSSFDrawing.NAMESPACE_A+"' .//a:t");
            //for (int m = 0; m < t.Length; m++)
            //{
            //    NodeList kids = t[m].GetDomNode().GetChildNodes();
            //    for (int n = 0; n < kids.GetLength(); n++)
            //    {
            //        if (kids.item(n) is Text)
            //        {
            //            text.Append(kids.item(n).GetNodeValue());
            //        }
            //    }
            //}
            string      xml = text.ToString();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            text.Length = 0;
            text.Append(doc.InnerText);
            return(new XSSFRichTextString(text.ToString()));
        }