How to get text and hyperlink data?

  • Hi:

    Using WPTools 6 I need to get to a certain line of text that has two hyperlinks, and form a string with plain text plus sign '&', plus hyperlink hidden data, just after the text that corresponds to each hyperlink.

    For example, I need to have the following string:

    "I want to travel to Berlin&[HLK_Data1] and to Munich&[HLK_Data2] this year".

    Can you please help me?

    Kind regards,

    Carlos Borrero

  • I was trying to wrap, the hyperlink value within the <a> tag of html. But the gridview wants us to add hyperlink as a control to the cell. The other approach I was trying is create and add the hyperlink class to the datarow directly (in datatable) and then binding the dataset to the grid, but somehow, the gridview was not displaying the hyperlink column. That was a bit strange to me. But anyways bohunkus, you have given a clean way.
    The other thing I was also trying to check is: Get the e.Row.Cells[1].Text's column name. So then, I can check for column name and only then I will add the hyperlink control. This way, I can use the same gridview for other data presentation purpose. Because, I am anyways binding the created dataset to the gridview i.e. programmatically, instead of hard coding the columns.

  • What is wrong with the following code?, it doesn't work, LocalHyperlinkObjects.Count is allways 0, no mather how many hyperlinks are in the document:

    Code
    LocalHyperlinkObjects := WPRichText.CodeListTags(wpobjHyperlink, '*ALL*', true);
    try
      for j := 0 to LocalHyperlinkObjects.Count - 1 do begin
         LocalHyperlinkObjects[j].Free;
      end; // for ...
    finally
      LocalHyperlinkObjects.Free;
    end;

    Kind regards,

    Carlos Borrero

    • Offizieller Beitrag

    Hi,

    Count will not be 0 if there are links. But the code is also not correct since it will only delete one of the two objects.

    You can remove the links