aspose.diagram
Class Page

Contains elements that define a page in the document.

Constructor Summary
Page()
           Constructor.
Page(ID)
           Constructor.
 
Property Getters/Setters Summary
functiongetAssociatedPage()
functionsetAssociatedPage(value)
           The ID of the original drawing page that was marked up on separate markup overlays by reviewers of the drawing.
functiongetBackground()
functionsetBackground(value)
           A flag indicating if the page is a background page. The value of the property is BOOL integer constant.
functiongetBackPage()
functionsetBackPage(value)
           The page's background page.
functiongetConnects()
           Contains a Connect element for each connection between two shapes in a drawing.
functiongetID()
functionsetID(value)
           The unique ID of the element within its parent element.
functiongetName()
functionsetName(value)
           The name of the element.
functiongetNameU()
functionsetNameU(value)
           The universal name of the element.
functiongetPages()
functionsetPages(value)
           Page collection.
functiongetPageSheet()
           Contains elements that define the page sheet for a Page or Master element.
functiongetReviewerID()
functionsetReviewerID(value)
           The ID of the reviewer associated with the markup overlay.
functiongetShapes()
           Shape collection.
functiongetViewCenterX()
functionsetViewCenterX(value)
           ViewCenterX and ViewCenterY specify a center point on a page that a new view (window) assumes when it is opened initially.
functiongetViewCenterY()
functionsetViewCenterY(value)
           ViewCenterX and ViewCenterY specify a center point on a page that a new view (window) assumes when it is opened initially.
functiongetViewScale()
functionsetViewScale(value)
           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.
 
Method Summary
functionaddActiveXControl(type, pinX, pinY, width, height)
           Creates an Activex Control.
functionaddComment(shape, comment)
           Adds comment to a shape.
functionaddComment(pinX, pinY, comment)
           Adds comment with defined PinX and PinY.
functionaddComment(shapeID, comment)
           Adds comment to a shape with shape's id.
functionaddShape(newShape, masterName)
           Adds shape created by master to specific page.
functionaddShape(pinX, pinY, width, height, masterName)
           Adds shape created by master on page with defined PinX,PinY,Width and Height.
functionaddShape(pinX, pinY, masterName)
           Adds shape created by master on page with defined PinX and PinY.
functionaddText(pinX, pinY, width, height, text)
           Adds Text with defined PinX and PinY.
functionapplyStyle(textStyle, lineStyle, fillStyle)
           Applies style for full page.
functionautoSpaceShapes(shapes, options)
           Auto space shapes
functionbringForward(shapeId)
           Brings a shape,defined by ID, forward one position in the z-order.
functionbringToFront(shapeId)
           Brings a shape,defined by ID, to the front of the z-order.
functionconnectShapesViaConnector(shapeFrom, placeFrom, shapeTo, placeTo, connector)
           Connect shapes via connector.
functionconnectShapesViaConnector(shapeFromId, placeFrom, shapeToId, placeTo, connectorId)
           Connect shapes via connector.
functionconnectShapesViaConnectorIndex(shapeFrom, fromIndex, shapeTo, toIndex, connector)
           Connect shapes via connector index.
functionconnectShapesViaConnectorIndex(shapeFromId, fromIndex, shapeToId, toIndex, connectorId)
           Connect shapes via connector index.
functioncopy(source)
          
functiondispose()
           Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
functionglueShapes(shapeFrom, placeTo, shapeTo)
           Glue shapes.
functionglueShapes(shapeFromId, placeTo, shapeToId)
           Glue shapes
functionglueShapesInContainer(shapeFromId, shapeToBeginConnectionIndex, shapeToEndConnectionIndex, shapeToId)
           Glue shapes in container
functionglueShapesInContainer(shapeFromId, shapeToBeginConnectionName, shapeToEndConnectionName, shapeToId)
           Glue shapes in container using connection name
functionglueShapesInContainerByID(shapeFromId, shapeToBeginConnectionID, shapeToEndConnectionID, shapeToId)
           Glue shapes by connetion id in container
functionlayout(options)
           Lays out the shapes and/or reroutes the connectors for the page.
functionmoveTo(index)
           Moves the page to another location in the pages.
functionsendBackward(shapeId)
           Moves a shape,defined by ID, back one position in the z-order.
functionsendToBack(shapeId)
           Moves a shape,defined by ID, to the back of the z-order.
 

Constructor Detail

Page

function Page()
Constructor.

Page

function Page(ID)
Constructor.

Property Getters/Setters Detail

getPages/setPages : PageCollection 

function getPages() / function setPages(value)
Page collection.

getShapes : ShapeCollection 

function getShapes()
Shape collection.

getPageSheet : PageSheet 

function getPageSheet()
Contains elements that define the page sheet for a Page or Master element.

getConnects : ConnectCollection 

function getConnects()
Contains a Connect element for each connection between two shapes in a drawing.

Example:

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

diagram = new aspose.diagram.Diagram("RetrieveConnectorInfo.vsd");
connects = diagram.getPages().getPage(0).getConnects();
for (var it = connects.iterator(); it.hasNext();) {
    connector = it.next();
    // Display information about the Connectors
    console.log("From Shape ID : " + connector.getFromSheet());
    console.log("To Shape ID : " + connector.getToSheet());
}

getID/setID : Number 

function getID() / function setID(value)
The unique ID of the element within its parent element.

getName/setName : String 

function getName() / function setName(value)
The name of the element.

getNameU/setNameU : String 

function getNameU() / function setNameU(value)
The universal name of the element.

getBackground/setBackground : Number 

function getBackground() / function setBackground(value)
A flag indicating if the page is a background page. The value of the property is BOOL integer constant.

Example:

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

diagram = new aspose.diagram.Diagram("RetrievePageInfo.vdx");

for (var it = diagram.getPages().iterator(); it.hasNext();) {
    page = it.next();
    // Checks if current page is a background page
    if (page.getBackground() == aspose.diagram.BOOL.TRUE) {
    // Display information about the background page
        console.log("Background Page ID : " + page.getID());
        console.log("Background Page Name : " + page.getName());
    } else {
        // Display information about the foreground page
        console.log("\nPage ID : " + page.getID());
        console.log("Universal Name : " + page.getNameU());
        console.log("ID of the Background Page : " + page.getBackPage());
    }
}

getBackPage/setBackPage : Page 

function getBackPage() / function setBackPage(value)
The page's background page.

getViewScale/setViewScale : Number 

function getViewScale() / function setViewScale(value)
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.

getViewCenterX/setViewCenterX : Number 

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

getViewCenterY/setViewCenterY : Number 

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

getReviewerID/setReviewerID : Number 

function getReviewerID() / function setReviewerID(value)
The ID of the reviewer associated with the markup overlay.

getAssociatedPage/setAssociatedPage : Page 

function getAssociatedPage() / function setAssociatedPage(value)
The ID of the original drawing page that was marked up on separate markup overlays by reviewers of the drawing.

Method Detail

copy

function copy(source)

dispose

function dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

applyStyle

function applyStyle(textStyle, lineStyle, fillStyle)
Applies style for full page. Default value is -1.
Parameters:
textStyle: Number - text Style id.
lineStyle: Number - line Style id.
fillStyle: Number - fill 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

function moveTo(index)
Moves the page to another location in the pages.
Parameters:
index: Number - Destination page index.

addActiveXControl

function addActiveXControl(type, pinX, pinY, width, height)
Creates an Activex Control.
Parameters:
type: Number - A ControlType value. The type of the control.
pinX: Number - Specifies the x-coordinate of the shape's pin (center of rotation) in relation to the page.
pinY: Number - Specifies the y-coordinate of the shape's pin (center of rotation) in relation to the page.
width: Number - Specifies the width of the shape in inches.
height: Number - Specifies the height of the shape in inches.
Returns:

Example:

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

// Instantiate Diagram Object
diagram = new aspose.diagram.Diagram();

// Insert an ActiveX control
diagram.getPages().get(0).addActiveXControl(aspose.diagram.ControlType.IMAGE, 1, 1, 1, 1);
    
diagram.save("out-InsertActiveXControl.vsdx", aspose.diagram.SaveFileFormat.VSDX);

addShape

function addShape(pinX, pinY, masterName)
Adds shape created by master on page with defined PinX and PinY.
Parameters:
pinX: Number - Specifies the x-coordinate of the shape's pin (center of rotation) in relation to the page.
pinY: Number - Specifies the y-coordinate of the shape's pin (center of rotation) in relation to the page.
masterName: String - Master's name.
Returns:
The unique ID of the shape within shapes collection on the specified page.

addShape

function addShape(pinX, pinY, width, height, masterName)
Adds shape created by master on page with defined PinX,PinY,Width and Height.
Parameters:
pinX: Number - Specifies the x-coordinate of the shape's pin (center of rotation) in relation to the page.
pinY: Number - Specifies the y-coordinate of the shape's pin (center of rotation) in relation to the page.
width: Number - Specifies the width of the shape in inches.
height: Number - Specifies the height of the shape in inches.
masterName: String - Master's name.
Returns:
The unique ID of the shape within shapes collection on the specified page.

addShape

function addShape(newShape, masterName)
Adds shape created by master to specific page.
Parameters:
newShape: Shape - New shape objectShape.
masterName: String - Master's name.
Returns:
The unique ID of the shape within shapes collection on the specified page.

layout

function layout(options)
Lays out the shapes and/or reroutes the connectors for the page.
Parameters:
options: LayoutOptions - Using the LayoutOptions to configure options of layout.

connectShapesViaConnector

function connectShapesViaConnector(shapeFrom, placeFrom, shapeTo, placeTo, connector)
Connect shapes via connector.
Parameters:
shapeFrom: Shape - The shape where the connector begins Shape.
placeFrom: Number - A ConnectionPointPlace value. The location on the first shape where connector will be connected ConnectionPointPlace.
shapeTo: Shape - The shape where the connector ends Shape.
placeTo: Number - A ConnectionPointPlace value. The location on the second shape where connector will be connected ConnectionPointPlace.
connector: Shape - The shape with type Dynamic connector Shape.

connectShapesViaConnector

function connectShapesViaConnector(shapeFromId, placeFrom, shapeToId, placeTo, connectorId)
Connect shapes via connector.
Parameters:
shapeFromId: long - The ID of shape where the connector begins Shape.
placeFrom: Number - A ConnectionPointPlace value. The location on the first shape where connector will be connected ConnectionPointPlace.
shapeToId: long - The ID of shape where the connector ends Shape.
placeTo: Number - A ConnectionPointPlace value. The location on the second shape where connector will be connected ConnectionPointPlace.
connectorId: long - The ID of shape with type Dynamic connector Shape.

Example:

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

diagram = new aspose.diagram.Diagram("AddingNewShape.vsdx");

// set sub shape ids
shapeFromId = 2;
shapeToId = 4;

// access a particular page
page = diagram.getPages().getPage("Page-3");

// initialize connector shape
shape = new aspose.diagram.Shape();
shape.getLine().getEndArrow().setValue(4);
shape.getLine().getLineWeight().setValue(0.01388);

// add shape
connecter1Id = page.addShape(shape, "Dynamic connector");

// connect sub-shapes
page.connectShapesViaConnector(
    shapeFromId,
    aspose.diagram.ConnectionPointPlace.RIGHT,
    shapeToId,
    aspose.diagram.ConnectionPointPlace.LEFT,
    connecter1Id);

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

connectShapesViaConnectorIndex

function connectShapesViaConnectorIndex(shapeFromId, fromIndex, shapeToId, toIndex, connectorId)
Connect shapes via connector index.
Parameters:
shapeFromId: long - The ID of shape where the connector begins Shape.
fromIndex: Number - The index of the connection on the first shape
shapeToId: long - The ID of shape where the connector ends Shape.
toIndex: Number - he index of the connection on the second shape
connectorId: long - The ID of shape with type Dynamic connector Shape.

connectShapesViaConnectorIndex

function connectShapesViaConnectorIndex(shapeFrom, fromIndex, shapeTo, toIndex, connector)
Connect shapes via connector index.
Parameters:
shapeFrom: Shape - The shape where the connector begins Shape.
fromIndex: Number - The index of the connection on the first shape
shapeTo: Shape - The shape where the connector ends Shape.
toIndex: Number - he index of the connection on the second shape
connector: Shape - The shape with type Dynamic connector Shape.

glueShapes

function glueShapes(shapeFrom, placeTo, shapeTo)
Glue shapes.
Parameters:
shapeFrom: Shape - The shape which is glue from Shape.
placeTo: Number - A ConnectionPointPlace value. The location on the first shape where to glue ConnectionPointPlace.
shapeTo: Shape - The shape where to glue to Shape.

glueShapes

function glueShapes(shapeFromId, placeTo, shapeToId)
Glue shapes
Parameters:
shapeFromId: long - The ID of shape which is glue from Shape.
placeTo: Number - A ConnectionPointPlace value. The location on the first shape where to glue ConnectionPointPlace.
shapeToId: long - The ID of shape where to glue to Shape.

Example:

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

diagram = new aspose.diagram.Diagram("GlueVisioShapes.vsdx");

// Get a particular page
page = diagram.getPages().getPage("Page-1");
// set shape id
shape1_ID = 7;
shape2_ID = 494;
// Glue shapes
page.glueShapes(shape1_ID, aspose.diagram.ConnectionPointPlace.CENTER, shape2_ID);

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

glueShapesInContainerByID

function glueShapesInContainerByID(shapeFromId, shapeToBeginConnectionID, shapeToEndConnectionID, shapeToId)
Glue shapes by connetion id in container
Parameters:
shapeFromId: long - The ID of shape which is glue from Shape.
shapeToBeginConnectionID: Number - The location on the first connection id where to glue .
shapeToEndConnectionID: Number - The location on the end connection id where to glue .
shapeToId: long - The ID of shape where to glue to Shape.

glueShapesInContainer

function glueShapesInContainer(shapeFromId, shapeToBeginConnectionName, shapeToEndConnectionName, shapeToId)
Glue shapes in container using connection name
Parameters:
shapeFromId: long - The ID of shape which is glue from Shape.
shapeToBeginConnectionName: String - The location on the first connection name where to glue .
shapeToEndConnectionName: String - The location on the end connection name where to glue .
shapeToId: long - The ID of shape where to glue to Shape.

glueShapesInContainer

function glueShapesInContainer(shapeFromId, shapeToBeginConnectionIndex, shapeToEndConnectionIndex, shapeToId)
Glue shapes in container
Parameters:
shapeFromId: long - The ID of shape which is glue from Shape.
shapeToBeginConnectionIndex: Number - The location on the first connection index where to glue .
shapeToEndConnectionIndex: Number - The location on the end connection index where to glue .
shapeToId: long - The ID of shape where to glue to Shape.

bringForward

function bringForward(shapeId)
Brings a shape,defined by ID, forward one position in the z-order.
Parameters:
shapeId: long - ID of shape.long

sendBackward

function sendBackward(shapeId)
Moves a shape,defined by ID, back one position in the z-order.
Parameters:
shapeId: long - ID of shape.long

bringToFront

function bringToFront(shapeId)
Brings a shape,defined by ID, to the front of the z-order.
Parameters:
shapeId: long - ID of shape.long

sendToBack

function sendToBack(shapeId)
Moves a shape,defined by ID, to the back of the z-order.
Parameters:
shapeId: long - ID of shape.long

addComment

function addComment(shapeID, comment)
Adds comment to a shape with shape's id.
Parameters:
shape - The ID of shape which is adding comment.
comment: String - Comment's string.

addComment

function addComment(shape, comment)
Adds comment to a shape.
Parameters:
shape: Shape - Specifies the shape which is adding comment .
comment: String - Comment's string.

addComment

function addComment(pinX, pinY, comment)
Adds comment with defined PinX and PinY.
Parameters:
pinX: Number - Specifies the x-coordinate of the comment's pin (center of rotation) in relation to the page.
pinY: Number - Specifies the y-coordinate of the comment's pin (center of rotation) in relation to the page.
comment: String - Comment'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

function autoSpaceShapes(shapes, options)
Auto space shapes
Parameters:
shapes: ShapeCollection - Specifies the shapes be auto spaced.

addText

function addText(pinX, pinY, width, height, text)
Adds Text with defined PinX and PinY.
Parameters:
pinX: Number - Specifies the x-coordinate of the text's pin (center of rotation) in relation to the page.
pinY: Number - Specifies the y-coordinate of the text's pin (center of rotation) in relation to the page.
text: String - text string.

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);

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.