Page

Page class

Contains elements that define a page in the document.

Constructors

NameDescription
PageConstructor.
PageConstructor.

Properties

NameTypeDescription
PagesPageCollectionPage collection.
ShapesShapeCollectionShape collection.
PageSheetPageSheetContains elements that define the page sheet for a Page or Master element.
ConnectsConnectCollectionContains a Connect element for each connection between two shapes in a drawing.
IDintThe unique ID of the element within its parent element.
NameStringThe name of the element.
NameUStringThe universal name of the element.
BackgroundintA flag indicating if the page is a background page. The value of the property is BOOL integer constant.
BackPagePageThe page’s background page.
ViewScalefloatThe default magnification factor to use when a new view (window) of the page is opened. For example, 1 = 100%; 1.5 = 150
ViewCenterXfloatViewCenterX and ViewCenterY specify a center point on a page that a new view (window) assumes when it is opened initiall
ViewCenterYfloatViewCenterX and ViewCenterY specify a center point on a page that a new view (window) assumes when it is opened initiall
ReviewerIDintThe ID of the reviewer associated with the markup overlay.
AssociatedPagePageThe ID of the original drawing page that was marked up on separate markup overlays by reviewers of the drawing.
PresetThemeintApply a preset theme to this page The value of the property is PresetThemeValue integer constant.
PresetThemeVariantintApply a preset theme variant to this page The value of the property is PresetThemeVariantValue integer constant.
PresetThemeQuickStyleintApply a preset theme variant quickstyle to this page The value of the property is PresetQuickStyleValue integer constant

Methods

NameDescription
centerDrawingCenters a page’s shapes with respect to the extent of the page. Centering shapes does not change their position relative
copy
disposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
applyStyleApplies style for full page.

Default value is -1. | | moveTo | Moves the page to another location in the pages. | | addShape | Adds shape created by master on page with defined PinX and PinY. | | connectShapesViaConnector | Connect shapes via connector. | | glueShapeToConnectorBeginX | Glue shape to Connector’s BeginX | | glueShapeToConnectorEndX | Glue shape to Connector’s EndX | | connectShapesViaConnectorIndex | Connect shapes via connector index. | | glueShapesInContainerByID | Glue shapes by connection id in container | | glueShapesInContainer | Glue shapes in container using connection name | | bringForward | Brings a shape,defined by ID, forward one position in the z-order. | | sendBackward | Moves a shape,defined by ID, back one position in the z-order. | | bringToFront | Brings a shape,defined by ID, to the front of the z-order. | | sendToBack | Moves a shape,defined by ID, to the back of the z-order. | | addComment | Adds comment to a shape with shape’s id. | | autoSpaceShapes | Auto space shapes | | addText | Adds Text with defined PinX and PinY. | | drawLine | The process of drawing a single line. | | drawRectangle | The process of drawing rectangle. | | drawEllipse | The process of drawing Ellipse. | | drawOwal | The process of drawing owal. | | dropContainer | The process of creating Container. | | drawPolyline | The process of drawing Polyline. |

Page() (1 of 2)

Constructor.


Page(ID) (2 of 2)

Constructor.

Page.Pages property

Page collection.

Type: PageCollection

Page.Shapes property

Shape collection.

Type: ShapeCollection

Page.PageSheet property

Contains elements that define the page sheet for a Page or Master element.

Type: PageSheet

Page.Connects property

Contains a Connect element for each connection between two shapes in a drawing.

Type: ConnectCollection

Page.ID property

The unique ID of the element within its parent element.

Type: int

Page.Name property

The name of the element.

Type: String

Page.NameU property

The universal name of the element.

Type: String

Page.Background property

A flag indicating if the page is a background page. The value of the property is BOOL integer constant.

Type: int

Page.BackPage property

The page’s background page.

Type: Page

Page.ViewScale property

The default magnification factor to use when a new view (window) of the page is opened. For example, 1 = 100%; 1.5 = 150%, and so on.

Type: float

Page.ViewCenterX property

ViewCenterX and ViewCenterY specify a center point on a page that a new view (window) assumes when it is opened initially.

Type: float

Page.ViewCenterY property

ViewCenterX and ViewCenterY specify a center point on a page that a new view (window) assumes when it is opened initially.

Type: float

Page.ReviewerID property

The ID of the reviewer associated with the markup overlay.

Type: int

Page.AssociatedPage property

The ID of the original drawing page that was marked up on separate markup overlays by reviewers of the drawing.

Type: Page

Page.PresetTheme property

Apply a preset theme to this page The value of the property is PresetThemeValue integer constant.

Type: int

Page.PresetThemeVariant property

Apply a preset theme variant to this page The value of the property is PresetThemeVariantValue integer constant.

Type: int

Page.PresetThemeQuickStyle property

Apply a preset theme variant quickstyle to this page The value of the property is PresetQuickStyleValue integer constant.

Type: int

centerDrawing()

Centers a page’s shapes with respect to the extent of the page. Centering shapes does not change their position relative to each other.

copy(source)

dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

applyStyle(textStyle, lineStyle, fillStyle)

Applies style for full page.

Default value is -1.

ParameterTypeDescription
textStyleinttext Style id.
lineStyleintline Style id.
fillStyleintfill Style id.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

diagram = new aspose.diagram.Diagram("ReadDiagramFile.vsd");

//Define a new StyleSheet
st = new aspose.diagram.StyleSheet();
st.setID(diagram.getStyleSheets().getCount() + 1);
ch = new aspose.diagram.Char();
ch.getColor().setValue("#00ff00");
ch.setIX(0);
st.getChars().add(ch);

st.getLine().getLineColor().setValue("#ff0000");
st.getLine().getLinePattern().setValue(1);

st.getLine().getLineWeight().setValue(0.01);
st.getFill().getFillForegnd().setValue("#0000ff");
st.getFill().getFillPattern().setValue(1);
st.getFill().getShdwPattern().setValue(0);

//Add the stylesheet to Stylesheets collection
diagram.getStyleSheets().add(st);

shapes = diagram.getPages().get(0).getShapes();
for (var it = shapes.iterator(); it.hasNext();) {
    shape = it.next();
    shape.getLine().getLinePattern().setValue(1);
    shape.getFill().getFillPattern().setValue(1);
}

//Apply the stylesheet
diagram.getPages().get(0).applyStyle(st.getID(), st.getID(), st.getID());
    
diagram.save("out-ApplyStyleToVisioDiagramPage.vsdx", aspose.diagram.SaveFileFormat.VSDX);

moveTo(index)

Moves the page to another location in the pages.

ParameterTypeDescription
indexintDestination page index.

addShape(pinX, pinY, masterName, isCalculate) (1 of 5)

Adds shape created by master on page with defined PinX and PinY.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the shape’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the shape’s pin (center of rotation) in relation to the page.
masterNameStringMaster’s name.
isCalculatebooleanIs Calculate shape or not.

Returns: The unique ID of the shape within shapes collection on the specified page.


addShape(pinX, pinY, width, height, masterName, isCalculate) (2 of 5)

Adds shape created by master on page with defined PinX and PinY.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the shape’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the shape’s pin (center of rotation) in relation to the page.
widthfloatSpecifies the width of the shape in inches.
heightfloatSpecifies the height of the shape in inches.
masterNameStringMaster’s name.
isCalculatebooleanIs Calculate shape or not.

Returns: The unique ID of the shape within shapes collection on the specified page.


addShape(pinX, pinY, masterName) (3 of 5)

Adds shape created by master on page with defined PinX and PinY.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the shape’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the shape’s pin (center of rotation) in relation to the page.
masterNameStringMaster’s name.

Returns: The unique ID of the shape within shapes collection on the specified page.


addShape(pinX, pinY, width, height, masterName) (4 of 5)

Adds shape created by master on page with defined PinX,PinY,Width and Height.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the shape’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the shape’s pin (center of rotation) in relation to the page.
widthfloatSpecifies the width of the shape in inches.
heightfloatSpecifies the height of the shape in inches.
masterNameStringMaster’s name.

Returns: The unique ID of the shape within shapes collection on the specified page.


addShape(newShape, masterName) (5 of 5)

Adds shape created by master to specific page.

ParameterTypeDescription
newShapeShapeNew shape object Shape .
masterNameStringMaster’s name.

Returns: The unique ID of the shape within shapes collection on the specified page.

connectShapesViaConnector(shapeFromId, fromConnectionName, shapeToId, toConnectionName, connectorId)

Connect shapes via connector.

ParameterTypeDescription
shapeFromIdlongThe ID of shape where the connector begins Shape .
fromConnectionNameStringThe connection name on the first shape where connector will be connected .
shapeToIdlongThe ID of shape where the connector ends Shape .
toConnectionNameStringThe connection name on the second shape where connector will be connected .
connectorIdlongThe ID of shape with type Dynamic connector Shape .

glueShapeToConnectorBeginX(shapeFromId, connectionName, connectorId)

Glue shape to Connector’s BeginX

ParameterTypeDescription
shapeFromIdlongThe ID of shape where the connector begins Shape .
connectionNameStringThe connection name on the shape where connector will be connected .
connectorIdlongThe ID of shape with type Dynamic connector Shape .

glueShapeToConnectorEndX(shapeToId, connectionName, connectorId)

Glue shape to Connector’s EndX

ParameterTypeDescription
shapeToIdlongThe ID of shape where the connector ends Shape .
connectionNameStringThe connection name on the second shape where connector will be connected .
connectorIdlongThe ID of shape with type Dynamic connector Shape .

connectShapesViaConnectorIndex(shapeFromId, fromIndex, shapeToId, toIndex, connectorId) (1 of 2)

Connect shapes via connector index.

ParameterTypeDescription
shapeFromIdlongThe ID of shape where the connector begins Shape .
fromIndexintThe index of the connection on the first shape
shapeToIdlongThe ID of shape where the connector ends Shape .
toIndexinthe index of the connection on the second shape
connectorIdlongThe ID of shape with type Dynamic connector Shape .

connectShapesViaConnectorIndex(shapeFrom, fromIndex, shapeTo, toIndex, connector) (2 of 2)

Connect shapes via connector index.

ParameterTypeDescription
shapeFromShapeThe shape where the connector begins Shape .
fromIndexintThe index of the connection on the first shape
shapeToShapeThe shape where the connector ends Shape .
toIndexinthe index of the connection on the second shape
connectorShapeThe shape with type Dynamic connector Shape .

glueShapesInContainerByID(shapeFromId, shapeToBeginConnectionID, shapeToEndConnectionID, shapeToId)

Glue shapes by connection id in container

ParameterTypeDescription
shapeFromIdlongThe ID of shape which is glue from Shape .
shapeToBeginConnectionIDintThe location on the first connection id where to glue .
shapeToEndConnectionIDintThe location on the end connection id where to glue .
shapeToIdlongThe ID of shape where to glue to Shape .

glueShapesInContainer(shapeFromId, shapeToBeginConnectionName, shapeToEndConnectionName, shapeToId) (1 of 2)

Glue shapes in container using connection name

ParameterTypeDescription
shapeFromIdlongThe ID of shape which is glue from Shape .
shapeToBeginConnectionNameStringThe location on the first connection name where to glue .
shapeToEndConnectionNameStringThe location on the end connection name where to glue .
shapeToIdlongThe ID of shape where to glue to Shape .

glueShapesInContainer(shapeFromId, shapeToBeginConnectionIndex, shapeToEndConnectionIndex, shapeToId) (2 of 2)

Glue shapes in container

ParameterTypeDescription
shapeFromIdlongThe ID of shape which is glue from Shape .
shapeToBeginConnectionIndexintThe location on the first connection index where to glue .
shapeToEndConnectionIndexintThe location on the end connection index where to glue .
shapeToIdlongThe ID of shape where to glue to Shape .

bringForward(shapeId)

Brings a shape,defined by ID, forward one position in the z-order.

ParameterTypeDescription
shapeIdlongID of shape. long

sendBackward(shapeId)

Moves a shape,defined by ID, back one position in the z-order.

ParameterTypeDescription
shapeIdlongID of shape. long

bringToFront(shapeId)

Brings a shape,defined by ID, to the front of the z-order.

ParameterTypeDescription
shapeIdlongID of shape. long

sendToBack(shapeId)

Moves a shape,defined by ID, to the back of the z-order.

ParameterTypeDescription
shapeIdlongID of shape. long

addComment(shapeID, comment) (1 of 3)

Adds comment to a shape with shape’s id.

ParameterTypeDescription
shapeIDlongThe ID of shape which is adding comment.
commentStringComment’s string.

addComment(shape, comment) (2 of 3)

Adds comment to a shape.

ParameterTypeDescription
shapeShapeSpecifies the shape which is adding comment .
commentStringComment’s string.

addComment(pinX, pinY, comment) (3 of 3)

Adds comment with defined PinX and PinY.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the comment’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the comment’s pin (center of rotation) in relation to the page.
commentStringComment’s string.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

var diagram = new aspose.diagram.Diagram("Drawing1.vsdx");
// Add comment
diagram.getPages().getPage(0).addComment(7.205905511811023, 3.880708661417323, "test@");
// Save diagram
diagram.save("out-AddPageLevelCommentInVisio.vsdx", aspose.diagram.SaveFileFormat.VSDX);

autoSpaceShapes(shapes, options)

Auto space shapes

ParameterTypeDescription
shapesShapeCollectionSpecifies the shapes be auto spaced.

addText(pinX, pinY, width, height, text, fontName, fontColor, size) (1 of 2)

Adds Text with defined PinX and PinY.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the text’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the text’s pin (center of rotation) in relation to the page.
widthfloatSpecifies the width of the text.
heightfloatSpecifies the height of the text.
textStringtext string.
fontNameStringtext font name.
fontColorStringtext font color.
sizefloattext font size.

Returns: Returns a shape object that represents the new text object.


addText(pinX, pinY, width, height, text) (2 of 2)

Adds Text with defined PinX and PinY.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the text’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the text’s pin (center of rotation) in relation to the page.
textStringtext string.

Returns: Returns a shape object that represents the new text object.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

diagram = new aspose.diagram.Diagram();

// set parameters
PinX = 1, PinY = 1, Width = 1, Height = 1;
text = "Test text";
// add text to a Visio page
diagram.getPages().getPage(0).addText(PinX, PinY, Width, Height, text);

diagram.save("out-InsertTextShape.vsdx", aspose.diagram.SaveFileFormat.VSDX);

drawLine(beginX, beginY, endX, endY) (1 of 2)

The process of drawing a single line.

ParameterTypeDescription
beginXfloatSpecifies the begin x-coordinate of the shape’s position in relation to the page.
beginYfloatSpecifies the begin y-coordinate of the shape’s position in relation to the page.
endXfloatSpecifies the end x-coordinate of the shape’s position in relation to the page.
endYfloatSpecifies the end y-coordinate of the shape’s position in relation to the page.

Returns: The unique ID of the shape within shapes collection on the specified page.


drawLine(pinX, pinY, width, height, xyArray) (2 of 2)

The process of drawing line.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the shape’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the shape’s pin (center of rotation) in relation to the page.
widthfloatSpecifies the width of the shape
heightfloatSpecifies the height of the shape
xyArrayNumber ArrayAn array of alternating x and y values that defines points in the new shape

Returns: The unique ID of the shape within shapes collection on the specified page.

drawRectangle(pinX, pinY, width, height) (1 of 2)

The process of drawing rectangle.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the shape’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the shape’s pin (center of rotation) in relation to the page.
widthfloatSpecifies the width of the shape
heightfloatSpecifies the height of the shape

Returns: The unique ID of the shape within shapes collection on the specified page.


drawRectangle(x1, y1, x2, y2) (2 of 2)

The process of drawing rectangle.

ParameterTypeDescription
x1floatSpecifies the x-coordinate representing the lower-left corner of the rectangle
y1floatSpecifies the y-coordinate representing the lower-left corner of the rectangle
x2floatSpecifies the x-coordinate representing the top-right corner of the rectangle
y2floatSpecifies the y-coordinate representing the top-right corner of the rectangle

Returns: The unique ID of the shape within shapes collection on the specified page.

drawEllipse(pinX, pinY, width, height)

The process of drawing Ellipse.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the shape’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the shape’s pin (center of rotation) in relation to the page.
widthfloatSpecifies the width of the shape
heightfloatSpecifies the height of the shape

drawOwal(x1, y1, x2, y2)

The process of drawing owal.

ParameterTypeDescription
x1floatSpecifies the x-coordinate representing the lower-left corner of the rectangle
y1floatSpecifies the y-coordinate representing the lower-left corner of the rectangle
x2floatSpecifies the x-coordinate representing the top-right corner of the rectangle
y2floatSpecifies the y-coordinate representing the top-right corner of the rectangle

Returns: The unique ID of the shape within shapes collection on the specified page.

dropContainer(targetShape)

The process of creating Container.

ParameterTypeDescription
targetShapeShapetarget shape

Returns: The shape within shapes collection on the specified page.

drawPolyline(xyArray) (1 of 2)

The process of drawing Polyline.

ParameterTypeDescription
xyArrayNumber ArrayAn array of alternating x and y values that defines points in the new shape

Returns: The unique ID of the shape within shapes collection on the specified page.


drawPolyline(pinX, pinY, width, height, xyArray) (2 of 2)

The process of drawing Polyline.

ParameterTypeDescription
pinXfloatSpecifies the x-coordinate of the shape’s pin (center of rotation) in relation to the page.
pinYfloatSpecifies the y-coordinate of the shape’s pin (center of rotation) in relation to the page.
widthfloatSpecifies the width of the shape
heightfloatSpecifies the height of the shape
xyArrayNumber ArrayAn array of alternating x and y values that defines points in the new shape

Returns: The unique ID of the shape within shapes collection on the specified page.