Visio.Hyperlink class

Represents the Hyperlink.

Extends

Remarks

[ API set: 1.1 ]

Properties

address

Gets the address of the Hyperlink object.

context

The request context associated with the object. This connects the add-in's process to the Office host application's process.

description

Gets the description of a hyperlink.

extraInfo

Gets the extra URL request information used to resolve the hyperlink's URL.

subAddress

Gets the sub-address of the Hyperlink object.

Methods

load(options)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNames)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNamesAndPaths)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

setMockData(data)

Set mock data

toJSON()

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Visio.Hyperlink object is an API object, the toJSON method returns a plain JavaScript object (typed as Visio.Interfaces.HyperlinkData) that contains shallow copies of any loaded child properties from the original object.

Property Details

Gets the address of the Hyperlink object.

readonly address: string;

Property Value

string

Remarks

[ API set: 1.1 ]

The request context associated with the object. This connects the add-in's process to the Office host application's process.

context: RequestContext;

Property Value

Gets the description of a hyperlink.

readonly description: string;

Property Value

string

Remarks

[ API set: 1.1 ]

Gets the extra URL request information used to resolve the hyperlink's URL.

readonly extraInfo: string;

Property Value

string

Remarks

[ API set: 1.1 ]

Gets the sub-address of the Hyperlink object.

readonly subAddress: string;

Property Value

string

Remarks

[ API set: 1.1 ]

Method Details

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(options?: Visio.Interfaces.HyperlinkLoadOptions): Visio.Hyperlink;

Parameters

options
Visio.Interfaces.HyperlinkLoadOptions

Provides options for which properties of the object to load.

Returns

Examples

Visio.run(session, function (ctx) {
    const activePage = ctx.document.getActivePage();
    const shape = activePage.shapes.getItem(0);
    const hyperlink = shape.hyperlinks.getItem(0);
    hyperlink.load();
    return ctx.sync().then(function() {
        console.log(hyperlink.description);
        console.log(hyperlink.address);
        console.log(hyperlink.subAddress);
        console.log(hyperlink.extraInfo);
     });
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNames?: string | string[]): Visio.Hyperlink;

Parameters

propertyNames

string | string[]

A comma-delimited string or an array of strings that specify the properties to load.

Returns

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): Visio.Hyperlink;

Parameters

propertyNamesAndPaths

{ select?: string; expand?: string; }

propertyNamesAndPaths.select is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand is a comma-delimited string that specifies the navigation properties to load.

Returns

Set mock data

setMockData(data: Visio.Interfaces.HyperlinkData): void;

Parameters

Returns

void

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Visio.Hyperlink object is an API object, the toJSON method returns a plain JavaScript object (typed as Visio.Interfaces.HyperlinkData) that contains shallow copies of any loaded child properties from the original object.

toJSON(): Visio.Interfaces.HyperlinkData;

Returns