Parsing RTF Hyperlink information

  • How can I determine if the current cursor location is in a hyperlink / or the current selection is a hyperlink - fetch the link + text for use in a properties dialog. (I'm assuming I can use the InputHyperlink function to overwrite the existing hyperlink after the user hits ok).

    I've tried the SelectionAsString, and this returns the formatted rtf string -- so I'm assuming I need to parse this somehow ... :)

    • Offizieller Beitrag

    Hi,

    I don't think you need to do anything more than to call procedure EditHyperlink(linktext: string = ''). 'linktext' is only used when no text is selected, if it is, it is wrapped into the hyperlink tags.

    Code
    WPRichText1.EditHyperlink('link');  WPRichText1.SetFocus;

    This is the implementation of 'EditHyperlink'

    Regards,

    Julian

    BTW: The hyperlinks in version 5 work completely different to the hyperlinks in WPTools 4 (were they were created with double underlined and hidden text).

    In V5 they consist of a start> and an end tag, similar to HTML, both represented by a TWPTextObj. You can make this tags visible suing a property in the FormatOptions!

    This properties of the TWPTextObj are used:

    Source = href
    Name = title
    ObjType - must be wpobjHyperlink!