Visio.ShapeView class

Represents the ShapeView class.

[ API set: 1.1 ]

Extends
OfficeExtension.ClientObject

Properties

highlight

Represents the highlight around the shape.

[ API set: 1.1 ]

Methods

addOverlay(OverlayType, Content, OverlayHorizontalAlignment, OverlayVerticalAlignment, Width, Height)

Adds an overlay on top of the shape.

[ API set: 1.1 ]

load(option)

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

removeOverlay(OverlayId)

Removes particular overlay or all overlays on the Shape.

[ API set: 1.1 ]

toJSON()

Property Details

highlight

Represents the highlight around the shape.

[ API set: 1.1 ]

highlight: Visio.Highlight;
Property Value

Method Details

addOverlay(OverlayType, Content, OverlayHorizontalAlignment, OverlayVerticalAlignment, Width, Height)

Adds an overlay on top of the shape.

[ API set: 1.1 ]

addOverlay(OverlayType: Visio.OverlayType, Content: string, OverlayHorizontalAlignment: Visio.OverlayHorizontalAlignment, OverlayVerticalAlignment: Visio.OverlayVerticalAlignment, Width: number, Height: number): OfficeExtension.ClientResult<number>;
Parameters
OverlayType
Visio.OverlayType

An Overlay Type. Can be 'Text' or 'Image'.

Content
string

Content of Overlay.

OverlayHorizontalAlignment
Visio.OverlayHorizontalAlignment

Horizontal Alignment of Overlay. Can be 'Left', 'Center', or 'Right'.

OverlayVerticalAlignment
Visio.OverlayVerticalAlignment

Vertical Alignment of Overlay. Can be 'Top', 'Middle', 'Bottom'.

Width
number

Overlay Width.

Height
number

Overlay Height.

Returns
OfficeExtension.ClientResult<number>

load(option)

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

load(option?: string | string[]): Visio.ShapeView;
Parameters
option
string | string[]

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

Returns
Remarks

In addition to this signature, this method has the following signatures:

load(option?: { select?: string; expand?: string; }): Visio.ShapeView - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load.

load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Visio.ShapeView - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items.

Examples

Visio.run(session, function (ctx) {
    var activePage = ctx.document.getActivePage();
    var shape = activePage.shapes.getItem(0);
    shape.view.highlight = { color: "#E7E7E7", width: 100 };
    return ctx.sync();
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});
Visio.run(session, function (ctx) {
    var activePage = ctx.document.getActivePage();
    var shape = activePage.shapes.getItem(0);
    var overlayId=shape.view.addOverlay(1, "Visio Online", 2, 2, 50, 50);
    return ctx.sync();
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});
Visio.run(session, function (ctx) {
    var activePage = ctx.document.getActivePage();
    var shape = activePage.shapes.getItem(0);
    shape.view.removeOverlay(1);
    return ctx.sync();
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

removeOverlay(OverlayId)

Removes particular overlay or all overlays on the Shape.

[ API set: 1.1 ]

removeOverlay(OverlayId: number): void;
Parameters
OverlayId
number

An Overlay Id. Removes the specific overlay id from the shape.

Returns
void

toJSON()

toJSON(): Visio.Interfaces.ShapeViewData;
Returns