Visio.ShapeDataItem class

Represents the ShapeDataItem.

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.

format

A string that specifies the format of the shape data item.

formattedValue

A string that specifies the formatted value of the shape data item.

label

A string that specifies the label of the shape data item.

value

A string that specifies the value of the shape data item.

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.ShapeDataItem object is an API object, the toJSON method returns a plain JavaScript object (typed as Visio.Interfaces.ShapeDataItemData) 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

format

A string that specifies the format of the shape data item.

readonly format: string;

Property Value

string

Remarks

[ API set: 1.1 ]

formattedValue

A string that specifies the formatted value of the shape data item.

readonly formattedValue: string;

Property Value

string

Remarks

[ API set: 1.1 ]

label

A string that specifies the label of the shape data item.

readonly label: string;

Property Value

string

Remarks

[ API set: 1.1 ]

value

A string that specifies the value of the shape data item.

readonly value: string;

Property Value

string

Remarks

[ API set: 1.1 ]

Method Details

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.ShapeDataItemLoadOptions): Visio.ShapeDataItem;

Parameters

options
Visio.Interfaces.ShapeDataItemLoadOptions

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 shapeDataItem = shape.shapeDataItems.getItem(0);
    shapeDataItem.load(["label", "value"]);
        return ctx.sync().then(function() {
            console.log(shapeDataItem.label);
            console.log(shapeDataItem.value);
        });
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

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

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

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

setMockData(data)

Set mock data

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

Parameters

Returns

void

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

toJSON(): Visio.Interfaces.ShapeDataItemData;

Returns