asposediagram.api

Contains elements that define a page in the document.

Constructor Summary
Page()
Constructor.
Page(ID)
Constructor.
 
Property Getters/Setters Summary
methodgetAssociatedPage()
method
           The ID of the original drawing page that was marked up on separate markup overlays by reviewers of the drawing.
methodgetBackground()
method
           A flag indicating if the page is a background page. The value of the property is BOOL integer constant.
methodgetBackPage()
method
           The page's background page.
methodgetConnects()
Contains a Connect element for each connection between two shapes in a drawing.
methodgetID()
method
setID(value)
           The unique ID of the element within its parent element.
methodgetName()
method
setName(value)
           The name of the element.
methodgetNameU()
method
setNameU(value)
           The universal name of the element.
methodgetPages()
method
setPages(value)
           Page collection.
methodgetPageSheet()
Contains elements that define the page sheet for a Page or Master element.
voidsetPresetTheme(value)
Apply a preset theme to this page The value of the property is PresetThemeValue integer constant.
voidsetPresetThemeQuickStyle(value)
Apply a preset theme variant quickstyle to this page The value of the property is PresetQuickStyleValue integer constant.
voidsetPresetThemeVariant(value)
Apply a preset theme variant to this page The value of the property is PresetThemeVariantValue integer constant.
methodgetReviewerID()
method
           The ID of the reviewer associated with the markup overlay.
methodgetShapes()
Shape collection.
methodgetViewCenterX()
method
           ViewCenterX and ViewCenterY specify a center point on a page that a new view (window) assumes when it is opened initially.
methodgetViewCenterY()
method
           ViewCenterX and ViewCenterY specify a center point on a page that a new view (window) assumes when it is opened initially.
methodgetViewScale()
method
           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
methodaddComment(shape, comment)
Adds comment to a shape.
methodaddComment(pinX, pinY, comment)
Adds comment with defined PinX and PinY.
methodaddComment(shapeID, comment)
Adds comment to a shape with shape's id.
methodaddShape(newShape, masterName)
Adds shape created by master to specific page.
methodaddShape(pinX, pinY, width, height, masterName)
Adds shape created by master on page with defined PinX,PinY,Width and Height.
methodaddShape(pinX, pinY, masterName)
Adds shape created by master on page with defined PinX and PinY.
methodaddText(pinX, pinY, width, height, text)
Adds Text with defined PinX and PinY.
methodaddText(pinX, pinY, width, height, text, fontName, fontColor, size)
Adds Text with defined PinX and PinY.
methodapplyStyle(textStyle, lineStyle, fillStyle)
Applies style for full page.
methodautoSpaceShapes(shapes, options)
Auto space shapes
methodbringForward(shapeId)
Brings a shape,defined by ID, forward one position in the z-order.
methodbringToFront(shapeId)
Brings a shape,defined by ID, to the front of the z-order.
methodcenterDrawing()
Centers a page's shapes with respect to the extent of the page. Centering shapes does not change their position relative to each other.
methodconnectShapesViaConnector(shapeFromId, fromConnectionName, shapeToId, toConnectionName, connectorId)
Connect shapes via connector.
methodconnectShapesViaConnectorIndex(shapeFrom, fromIndex, shapeTo, toIndex, connector)
Connect shapes via connector index.
methodconnectShapesViaConnectorIndex(shapeFromId, fromIndex, shapeToId, toIndex, connectorId)
Connect shapes via connector index.
methodcopy(source)
methoddispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
methoddrawEllipse(pinX, pinY, width, height)
The process of drawing Ellipse.
methoddrawLine(beginX, beginY, endX, endY)
The process of drawing a single line.
methoddrawLine(pinX, pinY, width, height, xyArray)
The process of drawing line.
methoddrawPolyline(pinX, pinY, width, height, xyArray)
The process of drawing Polyline.
methoddrawRectangle(pinX, pinY, width, height)
The process of drawing rectangle.
methodglueShapesInContainer(shapeFromId, shapeToBeginConnectionIndex, shapeToEndConnectionIndex, shapeToId)
Glue shapes in container
methodglueShapesInContainer(shapeFromId, shapeToBeginConnectionName, shapeToEndConnectionName, shapeToId)
Glue shapes in container using connection name
methodglueShapesInContainerByID(shapeFromId, shapeToBeginConnectionID, shapeToEndConnectionID, shapeToId)
Glue shapes by connection id in container
methodglueShapeToConnectorBeginX(shapeFromId, connectionName, connectorId)
Glue shape to Connector's BeginX
methodglueShapeToConnectorEndX(shapeToId, connectionName, connectorId)
Glue shape to Connector's EndX
methodmoveTo(index)
Moves the page to another location in the pages.
methodsendBackward(shapeId)
Moves a shape,defined by ID, back one position in the z-order.
methodsendToBack(shapeId)
Moves a shape,defined by ID, to the back of the z-order.
 

    • Constructor Detail

      • Page

        Page()
        Constructor.
      • Page

        Page(ID)
        Constructor.
    • Property Getters/Setters Detail

      • getPageSheet : PageSheet 

        PageSheet getPageSheet()
        
        Contains elements that define the page sheet for a Page or Master element.
      • getConnects : ConnectCollection 

        ConnectCollection 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 : int 

        int getID() / setID(value)
        
        The unique ID of the element within its parent element.
      • getName/setName : String 

        String getName() / setName(value)
        
        The name of the element.
      • getNameU/setNameU : String 

        String getNameU() / setNameU(value)
        
        The universal name of the element.
      • getBackground/setBackground : int 

        int getBackground() / 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 

        Page getBackPage() / setBackPage(value)
        
        The page's background page.
      • getViewScale/setViewScale : float 

        float getViewScale() / 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 : float 

        float getViewCenterX() / 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 : float 

        float getViewCenterY() / 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 : int 

        int getReviewerID() / setReviewerID(value)
        
        The ID of the reviewer associated with the markup overlay.
      • getAssociatedPage/setAssociatedPage : Page 

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

        setPresetTheme(value)
        
        Apply a preset theme to this page The value of the property is PresetThemeValue integer constant.
      • setPresetThemeVariant : int 

        setPresetThemeVariant(value)
        
        Apply a preset theme variant to this page The value of the property is PresetThemeVariantValue integer constant.
      • setPresetThemeQuickStyle : int 

        setPresetThemeQuickStyle(value)
        
        Apply a preset theme variant quickstyle to this page The value of the property is PresetQuickStyleValue integer constant.
    • Method Detail

      • centerDrawing

         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

         copy(source)
      • dispose

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

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

         moveTo(index)
        Moves the page to another location in the pages.
        Parameters:
        index: int - Destination page index.
      • addShape

        long addShape(pinX, pinY, masterName)
        Adds shape created by master on page with defined PinX and PinY.
        Parameters:
        pinX: float - Specifies the x-coordinate of the shape's pin (center of rotation) in relation to the page.
        pinY: float - 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

        long addShape(pinX, pinY, width, height, masterName)
        Adds shape created by master on page with defined PinX,PinY,Width and Height.
        Parameters:
        pinX: float - Specifies the x-coordinate of the shape's pin (center of rotation) in relation to the page.
        pinY: float - Specifies the y-coordinate of the shape's pin (center of rotation) in relation to the page.
        width: float - Specifies the width of the shape in inches.
        height: float - 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

        long 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.
      • connectShapesViaConnector

         connectShapesViaConnector(shapeFromId, fromConnectionName, shapeToId, toConnectionName, connectorId)
        Connect shapes via connector.
        Parameters:
        shapeFromId: long - The ID of shape where the connector begins Shape.
        fromConnectionName: String - The connection name on the first shape where connector will be connected .
        shapeToId: long - The ID of shape where the connector ends Shape.
        toConnectionName: String - The connection name on the second shape where connector will be connected .
        connectorId: long - The ID of shape with type Dynamic connector Shape.
      • glueShapeToConnectorBeginX

         glueShapeToConnectorBeginX(shapeFromId, connectionName, connectorId)
        Glue shape to Connector's BeginX
        Parameters:
        shapeFromId: long - The ID of shape where the connector begins Shape.
        connectionName: String - The connection name on the shape where connector will be connected .
        connectorId: long - The ID of shape with type Dynamic connector Shape.
      • glueShapeToConnectorEndX

         glueShapeToConnectorEndX(shapeToId, connectionName, connectorId)
        Glue shape to Connector's EndX
        Parameters:
        shapeToId: long - The ID of shape where the connector ends Shape.
        connectionName: String - The connection name on the second shape where connector will be connected .
        connectorId: long - The ID of shape with type Dynamic connector Shape.
      • connectShapesViaConnectorIndex

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

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

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

         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

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

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

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

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

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

         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

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

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

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

        Shape addText(pinX, pinY, width, height, text, fontName, fontColor, size)
        Adds Text with defined PinX and PinY.
        Parameters:
        pinX: float - Specifies the x-coordinate of the text's pin (center of rotation) in relation to the page.
        pinY: float - Specifies the y-coordinate of the text's pin (center of rotation) in relation to the page.
        width: float - Specifies the width of the text.
        height: float - Specifies the height of the text.
        text: String - text string.
        fontName: String - text font name.
        fontColor: String - text font color.
        size: float - text font size.
        Returns:
        Returns a shape object that represents the new text object.
      • addText

        Shape addText(pinX, pinY, width, height, text)
        Adds Text with defined PinX and PinY.
        Parameters:
        pinX: float - Specifies the x-coordinate of the text's pin (center of rotation) in relation to the page.
        pinY: float - Specifies the y-coordinate of the text's pin (center of rotation) in relation to the page.
        text: String - text 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

        long drawLine(beginX, beginY, endX, endY)
        The process of drawing a single line.
        Parameters:
        beginX: float - Specifies the begin x-coordinate of the shape's position in relation to the page.
        beginY: float - Specifies the begin y-coordinate of the shape's position in relation to the page.
        endX: float - Specifies the end x-coordinate of the shape's position in relation to the page.
        endY: float - Specifies 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.
      • drawRectangle

        long drawRectangle(pinX, pinY, width, height)
        The process of drawing rectangle.
        Parameters:
        pinX: float - Specifies the x-coordinate of the shape's pin (center of rotation) in relation to the page.
        pinY: float - Specifies the y-coordinate of the shape's pin (center of rotation) in relation to the page.
        width: float - Specifies the width of the shape
        height: float - Specifies the height of the shape
        Returns:
        The unique ID of the shape within shapes collection on the specified page.
      • drawLine

        long drawLine(pinX, pinY, width, height, xyArray)
        The process of drawing line.
        Parameters:
        pinX: float - Specifies the x-coordinate of the shape's pin (center of rotation) in relation to the page.
        pinY: float - Specifies the y-coordinate of the shape's pin (center of rotation) in relation to the page.
        width: float - Specifies the width of the shape
        height: float - Specifies the height of the shape
        xyArray: Number Array - An 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.
      • drawEllipse

        long drawEllipse(pinX, pinY, width, height)
        The process of drawing Ellipse.
        Parameters:
        pinX: float - Specifies the x-coordinate of the shape's pin (center of rotation) in relation to the page.
        pinY: float - Specifies the y-coordinate of the shape's pin (center of rotation) in relation to the page.
        width: float - Specifies the width of the shape
        height: float - Specifies the height of the shape
        Returns:
      • drawPolyline

        long drawPolyline(pinX, pinY, width, height, xyArray)
        The process of drawing Polyline.
        Parameters:
        pinX: float - Specifies the x-coordinate of the shape's pin (center of rotation) in relation to the page.
        pinY: float - Specifies the y-coordinate of the shape's pin (center of rotation) in relation to the page.
        width: float - Specifies the width of the shape
        height: float - Specifies the height of the shape
        xyArray: Number Array - An 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.