WPCubed Product Support

TWPRichText.LoadFromString and html text

Hi;
I can't add local hyperlink to my doc this my code :

UnicodeString str = "<A HREF=\"#motCle\">Go to link</A><br><br>";

str += " some text bla bla bla .....<br>.";

str += "<A NAME=\"motCle\">The link</A>";

WPRichText.LoadFromString(str, "html");

When I got my document RTF the link doest work.

So is the local link work on WPTools ? and if so What's wrong with my code ?

#1 ♥ 0
5.9k Views 2 users read 3 min
support

You need to use "href" instead of "name" for a hyperlink - otherwise you get a bookmark, not a link.

#2 ♥ 0

Thanks for the replay,
I think I have misspoken !
Here is an explanation of what I want to do:


Destination anchors in HTML documents may be specified either by the A element (naming it with the name attribute), or by any other element (naming with the id attribute).

Thus, for example, an author might create a table of contents whose entries link to header elements H2, H3, etc., in the same document. Using the A element to create destination anchors, we would write:

<H1>Table of Contents</H1><P><A href="#section1">Introduction</A><BR><A href="#section2">Some background</A><BR><A href="#section2.1">On a more personal note</A><BR>...the rest of the table of contents......the document body...<H2><A name="section1">Introduction</A></H2>...section 1...<H2><A name="section2">Some background</A></H2>...section 2...<H3><A name="section2.1">On a more personal note</A></H3>...section 2.1...

We may achieve the same effect by making the header elements themselves the anchors:

<H1>Table of Contents</H1>
<P><A href="#section1">Introduction</A><BR>
<A href="#section2">Some background</A><BR>
<A href="#section2.1">On a more personal note</A><BR>
...the rest of the table of contents...
...the document body...
<H2 id="section1">Introduction</H2>
...section 1...
<H2 id="section2">Some background</H2>
...section 2...
<H3 id="section2.1">On a more personal note</H3>
...section 2.1...

So can WPRichText understand the element <A> with the attribut "name" ?

#3 ♥ 0
support

WPTools understands the attribute NAME but wil, create a bookmark in this case, no hyperlink. You can change this behaviour in WPIOHTML if you need to.

The bookmarks can be made clickable using the property ClickableCodes. Default is wpobjHyperlink.

Regards,

Julian

#4 ♥ 0
This category is archived. No new posts are possible.