Visio.PageView class

Represents the PageView class.

Extends

Remarks

[ API set: 1.1 ]

Properties

context

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

zoom

Get and set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom.

Methods

centerViewportOnShape(ShapeId)

Pans the Visio drawing to place the specified shape in the center of the view.

fitToWindow()

Fit Page to current window.

getPosition()

Returns the position object that specifies the position of the page in the view.

getSelection()

Represents the Selection in the page.

isShapeInViewport(Shape)

To check if the shape is in view of the page or not.

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.

set(properties, options)

Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type.

set(properties)

Sets multiple properties on the object at the same time, based on an existing loaded object.

setMockData(data)

Set mock data

setPosition(Position)

Sets the position of the page in the view.

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.PageView object is an API object, the toJSON method returns a plain JavaScript object (typed as Visio.Interfaces.PageViewData) that contains shallow copies of any loaded child properties from the original object.

Property Details

context

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

zoom

Get and set Page's Zoom level. The value can be between 10 and 400 and denotes the percentage of zoom.

zoom: number;

Property Value

number

Remarks

[ API set: 1.1 ]

Examples

Visio.run(session, function (ctx) {
    const activePage = ctx.document.getActivePage();
    activePage.view.zoom = 300;
    return ctx.sync();
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

Method Details

centerViewportOnShape(ShapeId)

Pans the Visio drawing to place the specified shape in the center of the view.

centerViewportOnShape(ShapeId: number): void;

Parameters

ShapeId

number

ShapeId to be seen in the center.

Returns

void

Remarks

[ API set: 1.1 ]

Examples

Visio.run(session, function (ctx) {
    const activePage = ctx.document.getActivePage();
    const shape = activePage.shapes.getItem(0);
    activePage.view.centerViewportOnShape(shape.Id);
    return ctx.sync();
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

fitToWindow()

Fit Page to current window.

fitToWindow(): void;

Returns

void

Remarks

[ API set: 1.1 ]

getPosition()

Returns the position object that specifies the position of the page in the view.

getPosition(): OfficeExtension.ClientResult<Visio.Position>;

Returns

Remarks

[ API set: 1.1 ]

getSelection()

Represents the Selection in the page.

getSelection(): Visio.Selection;

Returns

Remarks

[ API set: 1.1 ]

isShapeInViewport(Shape)

To check if the shape is in view of the page or not.

isShapeInViewport(Shape: Visio.Shape): OfficeExtension.ClientResult<boolean>;

Parameters

Shape
Visio.Shape

Shape to be checked.

Returns

Remarks

[ API set: 1.1 ]

load(options)

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.PageViewLoadOptions): Visio.PageView;

Parameters

options
Visio.Interfaces.PageViewLoadOptions

Provides options for which properties of the object to load.

Returns

load(propertyNames)

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.PageView;

Parameters

propertyNames

string | string[]

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

Returns

load(propertyNamesAndPaths)

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.PageView;

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(properties, options)

Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type.

set(properties: Interfaces.PageViewUpdateData, options?: OfficeExtension.UpdateOptions): void;

Parameters

properties
Visio.Interfaces.PageViewUpdateData

A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called.

options
OfficeExtension.UpdateOptions

Provides an option to suppress errors if the properties object tries to set any read-only properties.

Returns

void

set(properties)

Sets multiple properties on the object at the same time, based on an existing loaded object.

set(properties: Visio.PageView): void;

Parameters

properties
Visio.PageView

Returns

void

setMockData(data)

Set mock data

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

Parameters

Returns

void

setPosition(Position)

Sets the position of the page in the view.

setPosition(Position: Visio.Position): void;

Parameters

Position
Visio.Position

Position object that specifies the new position of the page in the view.

Returns

void

Remarks

[ API set: 1.1 ]

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.PageView object is an API object, the toJSON method returns a plain JavaScript object (typed as Visio.Interfaces.PageViewData) that contains shallow copies of any loaded child properties from the original object.

toJSON(): Visio.Interfaces.PageViewData;

Returns