3

I created rtf file with hyperlink in MS Word and loaded it into RichTextBox. Hyperlink in RichTextBox does not work. Are RichTextBox and MS Word use different rtf code? How can I create hyperlink with my parameters (to use the hyperlink without URL) in RichTextBox?

Displayed text looks like:

Some start text. Here must be hyperlink: Link_Text. And here text after hyperlink. Some end text.

Rtf text:

{\rtf1\ansi\ansicpg1251\deff0\deflang1058\deflangfe1058\deftab708{\fonttbl{\f0\fswiss\fprq2\fcharset204 Calibri;}{\f1\fswiss\fprq2\fcharset0 Calibri;}} {\colortbl ;\red0\green0\blue255;} {*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\nowidctlpar\f0\fs22 Some start text.\par \pard Here must be hyperlink: {\field{*\fldinst{HYPERLINK "address"}}{\fldrslt{\cf1\ul Link_Text}}}\cf0\ulnone\f0\fs22 . And here text after hyperlink.\par Some end text\lang1033\f1 .\lang1058\f0\par }

Gorf
  • 815
  • 1
  • 8
  • 12

1 Answers1

2

I can point you to some way that I myself don't know to where it ends. It is of course one of my questions that how can we use this hyperlink feature to embed our objects to the rtf. see if the following code is useful:

{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fnil\fcharset0 Calibri;}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\vieww12000\viewh13860\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\fs22 \cf0 Here are some start text, {\field{\*\fldinst{HYPERLINK "http://www.msn.com"}}{\fldrslt this is hyper link}} Here are some final text\
}

Copy and paste it to an editor like MacVim and save it as rtf, then open it with MSWordPad or some thing like TextEdit. this must show fine where link has different text. Now open it in the richtextbox and you will see it will be interpreted differently :(.

To see the point follow this thread.

Community
  • 1
  • 1
Yasser Sobhdel
  • 611
  • 8
  • 26