GetTextRecursive() static private method

static private GetTextRecursive ( System.Xml.Linq.XElement Xml, StringBuilder &sb ) : void
Xml System.Xml.Linq.XElement
sb StringBuilder
return void
Exemplo n.º 1
0
        internal Hyperlink(DocX document, PackagePart mainPart, XElement i) : base(document, i)
        {
            this.type = 0;
            this.id   = i.Attribute(XName.Get("id", DocX.r.NamespaceName)).Value;

            StringBuilder sb = new StringBuilder();

            HelperFunctions.GetTextRecursive(i, ref sb);
            this.text = sb.ToString();
        }
Exemplo n.º 2
0
        internal Hyperlink(DocX document, XElement instrText, List <XElement> runs) : base(document, null)
        {
            this.type      = 1;
            this.instrText = instrText;
            this.runs      = runs;

            try
            {
                int start = instrText.Value.IndexOf("HYPERLINK \"") + "HYPERLINK \"".Length;
                int end   = instrText.Value.IndexOf("\"", start);
                if (start != -1 && end != -1)
                {
                    this.uri = new Uri(instrText.Value.Substring(start, end - start), UriKind.Absolute);

                    StringBuilder sb = new StringBuilder();
                    HelperFunctions.GetTextRecursive(new XElement(XName.Get("temp", DocX.w.NamespaceName), runs), ref sb);
                    this.text = sb.ToString();
                }
            }

            catch (Exception e) { throw e; }
        }