HyperlinkCollection object (JavaScript API for Visio)
Applies to: Visio Online
Represents the Hyperlink Collection.
Properties
| Property | Type | Description |
|---|---|---|
| items | Hyperlink[] | A collection of hyperlink objects. Read-only. |
See property access examples.
Relationships
None
Methods
| Method | Return Type | Description |
|---|---|---|
| getCount() | int | Gets the number of hyperlinks. |
| getItem(Key: number or string) | Hyperlink | Gets a Hyperlink using its key (name or Id). |
| load(param: object) | void | Fills the proxy object created in JavaScript layer with property and object values specified in the parameter. |
Method Details
getCount()
Gets the number of hyperlinks.
Syntax
hyperlinkCollectionObject.getCount();
Parameters
None
Returns
int
getItem(Key: number or string)
Gets a Hyperlink using its key (name or Id).
Syntax
hyperlinkCollectionObject.getItem(Key);
Parameters
| Parameter | Type | Description | |
|---|---|---|---|
| Key | number or string | Key is the name or index of the Hyperlink to be retrieved. |
Returns
load(param: object)
Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.
Syntax
object.load(param);
Parameters
| Parameter | Type | Description | |
|---|---|---|---|
| param | object | Optional. Accepts parameter and relationship names as delimited string or an array. Or, provide loadOption object. |
Returns
void
Property access examples
Visio.run(function (ctx) {
var activePage = ctx.document.getActivePage();
var shapeName = "Manager Belt";
var shape = activePage.shapes.getItem(shapeName);
var hyperlinks = shape.hyperlinks;
shapeHyperlinks.load();
ctx.sync().then(function () {
for(var i=0; i<shapeHyperlinks.items.length;i++)
{
var hyperlink = shapeHyperlinks.items[i];
console.log("Description:"+hyperlink.description +"Address:"+hyperlink.address +"SubAddress: "+ hyperlink.subAddress);
}
});
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});