Reports for WinForms | ComponentOne
Working with C1PrintDocument / Anchors and Hyperlinks / Adding a Hyperlink to a Location Within the Current Document
In This Topic
    Adding a Hyperlink to a Location Within the Current Document
    In This Topic

    You can add a link to an object within the current document without creating an anchor. Instead, you can use the C1LinkTargetDocumentLocation link target created directly on a render object, like this, where ro1 is an arbitrary render object in the current document:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Dim linkTarget = New C1.C1Preview.C1LinkTargetDocumentLocation(ro1)
    

    To write code in C#

    C#
    Copy Code
    C1LinkTarget linkTarget = new C1LinkTargetDocumentLocation(ro1);
    

    Setting this link target on a hyperlink will make that hyperlink jump to the specified render object when the object owning the hyperlink is clicked. If, for example, ro2 is a render object that you want to turn into a hyperlink, the following code will link it to the location of ro1 on which the linkTarget was created as shown in the code snippet above:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    rt2.Hyperlink = New C1.C1Preview.C1Hyperlink()
    rt2.Hyperlink.LinkTarget = linkTarget
    

    To write code in C#

    C#
    Copy Code
    rt2.Hyperlink = new C1Hyperlink();
    rt2.Hyperlink.LinkTarget = linkTarget;
    

    Note that in this example, the LinkTarget property of the hyperlink was set after the hyperlink has been created.