Esempio n. 1
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 \"");
                if (start != -1)
                {
                    start += "HYPERLINK \"".Length;
                }
                int end = instrText.Value.IndexOf("\"", Math.Max(0, 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; }
        }
Esempio n. 2
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();
        }