Assigning a Hyperlink to an Image

  • Hi,

    I am adding a an image using the following:

    Img:=TWPOImage.Create(WP2);
    Img.FileExtension:='JPG';
    Img.LoadFromStream(lStream);
    lStream.Free;
    Img.WidthTW:=Img.ContentsWidth;
    Img.HeightTW:=Img.ContentsHeight;
    Obj:=Cell.AppendNewObject(wpobjImage,false,false,0);
    Obj.ObjRef:=Img;

    How can I add a hyperlink to the image?

    Thanks,

    Ken

    • Offizieller Beitrag

    Hi,

    You need to create a hyperlink and put the image within.

    Normaly you can use InputHyperlink to create a hyperlink.

    If you need to work directly on a cell or paragraph do this:

    Cell.AppendNewObjectPair(wpobjHyperlink,'',0).Source := 'http:\\http://www.wpcubed.com'
    Cell.InsertNewObject(
    Cell.CharCount-1,
    wpobjImage,
    false, false, 0
    ).ObjRef := Img;