AddHyperlinkToPageShape Method

Adds a hyperlink pointing to a page or a shape located on the specified page of the ConceptDraw document to the hyperlink collection of the document. Returns the ID (ID property) of the added hyperlink.

Applies to: Document object

Syntax

[[Let] linkIDRet = ] object.AddHyperlinkToPageShape ( pageID, [shapeID] )

The AddHyperlinkToPageShape method syntax has these parts:

Part Description
object Required. An expression that returns an instance of the Document object.
pageID

Required. An expression that returns a Long value. Specifies the ID (the ID property) of the page, to which the added hyperlink will point.

shapeID

Optional. An expression that returns a Long value. Represents the ID of the shape to which the added hyperlink will point. The default value is 0, which means the hyperlink doesn't point to any specific shape.

linkIDRet Optional. A Long type variable.

Remarks

If the hyperlink was added successfully, the AddHyperlinkToPageShape method returns the ID of the added hyperlink. If the hyperlink collection of the document already contains a hyperlink with the same properties, the method doesn't create a new hyperlink, but returns the ID of the identical hyperlink. In all other cases the method returns 0.

A hyperlink created with the AddHyperlinkToPageShape method has the cdLinkToPageShape type (see the LinkType property).

Example

This example contains a document-level script. The program creates the header and the footnote on the active page of the document, represented by two rectangles at the top and bottom of the page. Each rectangle has a hyperlink, pointing to the other rectangle. The hyperlinks are added by using the AddHyperlinkToPageShape method.

' Declare variables
Dim a_page As Page
Dim header As Shape
Dim footer As Shape
Dim linkid1 As Integer
Dim linkid2 As Integer

' Get the active page
Set a_page = thisDoc.ActivePage


' Create the header for the page
Set header = a_page.DrawRect( 0, -50, thisDoc.PageSizeX, 0)
' Create the footnote for the page
Set footer = a_page.DrawRect( 0, thisDoc.PageSizeY, thisDoc.PageSizeX, thisDoc.PageSizeY+50 )

' Add hyperlink pointing to header
Let linkid1 = thisDoc.AddHyperlinkToPageShape( a_page.ID, header.ID )

' Add hyperlink pointing to header
Let linkid2 = thisDoc.AddHyperlinkToPageShape( a_page.ID, footer.ID )
' Assign hyperlinks to shapes
Let header.Hyperlink = linkid2
Let footer.Hyperlink = linkid1

header.DblClick = 4
footer.DblClick = 4

header.Text = "PAGE START - Double click to go to the end of page"
footer.Text = "PAGE END - Double click to go to the beginning of page"

 

See Also

ID property, LinkType property, AddHyperlinkToDocument method, AddHyperlinkToFile method, AddHyperlinkToURL method, Hyperlink method, HyperlinkByID method, HyperlinksNum method, RemoveUnusedHyperlinks method, Hyperlink object