Visio.ShapeView class
Represents the ShapeView class.
[ API set: 1.1 ]
- Extends
-
OfficeExtension.ClientObject
Properties
context | The request context associated with the object. This connects the add-in's process to the Office host application's process. |
highlight | Represents the highlight around the shape. [ API set: 1.1 ] |
Methods
add |
Adds an overlay on top of the shape. [ API set: 1.1 ] |
add |
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. |
load(property |
Queues up a command to load the specified properties of the object. You must call |
load(property |
Queues up a command to load the specified properties of the object. You must call |
remove |
Removes particular overlay or all overlays on the Shape. [ API set: 1.1 ] |
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. |
show |
Shows particular overlay on the Shape. [ API set: 1.1 ] |
toJSON() | Overrides the JavaScript |
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
highlight
Represents the highlight around the shape.
[ API set: 1.1 ]
highlight: Visio.Highlight;
Property Value
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));
}
});
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
- 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'.
Returns
Examples
Visio.run(session, function (ctx) {
var activePage = ctx.document.getActivePage();
var shape = activePage.shapes.getItem(0);
var overlayId = shape.view.addOverlay("Image", "Visio Online", "Center", "Middle", 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));
}
});
addOverlay(OverlayTypeString, Content, OverlayHorizontalAlignment, OverlayVerticalAlignment, Width, Height)
Adds an overlay on top of the shape.
[ API set: 1.1 ]
addOverlay(OverlayTypeString: "Text" | "Image" | "Html", Content: string, OverlayHorizontalAlignment: "Left" | "Center" | "Right", OverlayVerticalAlignment: "Top" | "Middle" | "Bottom", Width: number, Height: number): OfficeExtension.ClientResult<number>;
Parameters
- OverlayHorizontalAlignment
- "Left" | "Center" | "Right"
Horizontal Alignment of Overlay. Can be 'Left', 'Center', or 'Right'.
- OverlayVerticalAlignment
- "Top" | "Middle" | "Bottom"
Vertical Alignment of Overlay. Can be 'Top', 'Middle', 'Bottom'.
Returns
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?: Visio.Interfaces.ShapeViewLoadOptions): Visio.ShapeView;
Parameters
Returns
Remarks
In addition to this signature, this method has the following signatures:
load(option?: string | string[]): Visio.ShapeView
- Where option is a comma-delimited string or an array of strings that specify the properties to load.
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.
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.ShapeView;
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.ShapeView;
Parameters
- propertyNamesAndPaths
- { select?: string; expand?: string; }
Where 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
removeOverlay(OverlayId)
Removes particular overlay or all overlays on the Shape.
[ API set: 1.1 ]
removeOverlay(OverlayId: number): void;
Parameters
Returns
Examples
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));
}
});
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.ShapeViewUpdateData, options?: OfficeExtension.UpdateOptions): void;
Parameters
- properties
- Interfaces.ShapeViewUpdateData
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
Remarks
This method has the following additional signature:
set(properties: Visio.ShapeView): void
set(properties)
Sets multiple properties on the object at the same time, based on an existing loaded object.
set(properties: Visio.ShapeView): void;
Parameters
- properties
- Visio.ShapeView
Returns
showOverlay(overlayId, show)
Shows particular overlay on the Shape.
[ API set: 1.1 ]
showOverlay(overlayId: number, show: boolean): void;
Parameters
Returns
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.ShapeView object is an API object, the toJSON
method returns a plain JavaScript object (typed as Visio.Interfaces.ShapeViewData
) that contains shallow copies of any loaded child properties from the original object.
toJSON(): Visio.Interfaces.ShapeViewData;
Returns
Feedback
Loading feedback...