Find out all the hyperlinks within the selected rtf text.

  • Hi,

    The TWPRTFDataCollection (WPRichText.HeaderFooter object) defines this procedure:

    procedure CallForSelectedText(
    Sender: TObject; Options: TWPCallForSelectedTextOptions;
    ParCallback: TWPParCallback; CharAttCallback: TWPCharAttrCallback;
    CharCallBack: TWPCharCallback; TextObjCallback: TWPTextObjectCallback;
    spar: TParagraph = nil; epar: TParagraph = nil;
    spos: Integer = 0; epos: Integer = 0);

    You can use the TextObjCallback (set all others to nil) to get all selected objects and check if the ObjType = wpobjHyperlink and read the URL from TxtObj.Source

    see here: https://www.wpcubed.com/manuals/wptool…electedText.htm

    Julian