Пример #1
0
        /// <summary>
        ///   Renders a hyperlink to RTF.
        /// </summary>
        internal override void Render()
        {
            _useEffectiveValue = true;
            _rtfWriter.StartContent();
            _rtfWriter.WriteControl("field");
            _rtfWriter.StartContent();
            _rtfWriter.WriteControl("fldinst", true);
            _rtfWriter.WriteText("HYPERLINK ");
            string name = _hyperlink.Filename;

            if (_hyperlink.IsNull("Type") || _hyperlink.Type == HyperlinkType.Local)
            {
                name = BookmarkFieldRenderer.MakeValidBookmarkName(_hyperlink.BookmarkName);
                _rtfWriter.WriteText(@"\l ");
            }
            else if (_hyperlink.Type == HyperlinkType.File || _hyperlink.Type == HyperlinkType.ExternalBookmark) // Open at least the document for external bookmarks (in PDF: Links to external named destinations).
            {
                string workingDirectory = _docRenderer.WorkingDirectory;
                if (workingDirectory != null)
                {
                    name = Path.Combine(_docRenderer.WorkingDirectory, name);
                }

                name = name.Replace(@"\", @"\\");
            }

            _rtfWriter.WriteText("\"" + name + "\"");
            _rtfWriter.EndContent();
            _rtfWriter.StartContent();
            _rtfWriter.WriteControl("fldrslt");
            _rtfWriter.StartContent();
            _rtfWriter.WriteControl("cs", _docRenderer.GetStyleIndex("Hyperlink"));

            FontRenderer fontRenderer = new FontRenderer(_hyperlink.Font, _docRenderer);

            fontRenderer.Render();

            if (!_hyperlink.IsNull("Elements"))
            {
                foreach (DocumentObject domObj in _hyperlink.Elements)
                {
                    RendererFactory.CreateRenderer(domObj, _docRenderer).Render();
                }
            }
            _rtfWriter.EndContent();
            _rtfWriter.EndContent();
            _rtfWriter.EndContent();
        }
Пример #2
0
        /// <summary>
        /// Renders a hyperlink to RTF.
        /// </summary>
        internal override void Render()
        {
            useEffectiveValue = true;
            this.rtfWriter.StartContent();
            this.rtfWriter.WriteControl("field");
            this.rtfWriter.StartContent();
            this.rtfWriter.WriteControl("fldinst", true);
            this.rtfWriter.WriteText("HYPERLINK ");
            string name = this.hyperlink.Name;

            if (this.hyperlink.IsNull("Type") || this.hyperlink.Type == HyperlinkType.Local)
            {
                name = BookmarkFieldRenderer.MakeValidBookmarkName(this.hyperlink.Name);
                this.rtfWriter.WriteText(@"\l ");
            }
            else if (this.hyperlink.Type == HyperlinkType.File)
            {
                string workingDirectory = this.docRenderer.WorkingDirectory;
                if (workingDirectory != null)
                {
                    name = Path.Combine(this.docRenderer.WorkingDirectory, name);
                }

                name = name.Replace(@"\", @"\\");
            }

            this.rtfWriter.WriteText("\"" + name + "\"");
            this.rtfWriter.EndContent();
            this.rtfWriter.StartContent();
            this.rtfWriter.WriteControl("fldrslt");
            this.rtfWriter.StartContent();
            this.rtfWriter.WriteControl("cs", this.docRenderer.GetStyleIndex("Hyperlink"));

            FontRenderer fontRenderer = new FontRenderer(this.hyperlink.Font, this.docRenderer);

            fontRenderer.Render();

            if (!this.hyperlink.IsNull("Elements"))
            {
                foreach (DocumentObject domObj in hyperlink.Elements)
                {
                    RendererFactory.CreateRenderer(domObj, this.docRenderer).Render();
                }
            }
            this.rtfWriter.EndContent();
            this.rtfWriter.EndContent();
            this.rtfWriter.EndContent();
        }
Пример #3
0
    /// <summary>
    /// Renders a hyperlink to RTF.
    /// </summary>
    internal override void Render()
    {
      useEffectiveValue = true;
      this.rtfWriter.StartContent();
      this.rtfWriter.WriteControl("field");
      this.rtfWriter.StartContent();
      this.rtfWriter.WriteControl("fldinst", true);
      this.rtfWriter.WriteText("HYPERLINK ");
      string name = this.hyperlink.Name;
      if (this.hyperlink.IsNull("Type") || this.hyperlink.Type == HyperlinkType.Local)
      {
        name = BookmarkFieldRenderer.MakeValidBookmarkName(this.hyperlink.Name);
        this.rtfWriter.WriteText(@"\l ");
      }
      else if (this.hyperlink.Type == HyperlinkType.File)
      {
        string workingDirectory = this.docRenderer.WorkingDirectory;
        if (workingDirectory != null)
          name = Path.Combine(this.docRenderer.WorkingDirectory, name);

        name = name.Replace(@"\", @"\\");
      }

      this.rtfWriter.WriteText("\"" + name + "\"");
      this.rtfWriter.EndContent();
      this.rtfWriter.StartContent();
      this.rtfWriter.WriteControl("fldrslt");
      this.rtfWriter.StartContent();
      this.rtfWriter.WriteControl("cs", this.docRenderer.GetStyleIndex("Hyperlink"));

      FontRenderer fontRenderer = new FontRenderer(this.hyperlink.Font, this.docRenderer);
      fontRenderer.Render();

      if (!this.hyperlink.IsNull("Elements"))
      {
        foreach (DocumentObject domObj in hyperlink.Elements)
          RendererFactory.CreateRenderer(domObj, this.docRenderer).Render();
      }
      this.rtfWriter.EndContent();
      this.rtfWriter.EndContent();
      this.rtfWriter.EndContent();
    }