asposediagram.api

Contains elements that define a shape in a Master, Page, or group shape element.

Example:

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

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

for (it = diagram.getPages().getPage("Page-2").getShapes().iterator(); it.hasNext();) {
    shape = it.next();
    // Display information about the shapes
    console.log("Shape ID : " + shape.getID());
    console.log("Name : " + shape.getName());
    console.log("Master Shape : " + shape.getMaster().getName());
}

Constructor Summary
Shape()
Constructor.
 
Property Getters/Setters Summary
methodgetActiveXControl()
Gets the ActiveX control.
methodgetActs()
Contains a collection of Act elements.
methodgetAlign()
Indicates the alignment of a shape with respect to the guide or guide point to which the shape is glued. The Align element appears only for shapes that are glued to guides or guide points.
methodgetChars()
Contains a collection of Char elements.
methodgetClippingPath()
method
          
methodgetConnectionABCDs()
Contains a collection of ConnectionABCD elements.
methodgetConnections()
Contains a collection of Connection elements.
methodgetControlData()
Gets the data of control.
methodgetControls()
Contains a collection of Control elements.
methodgetData1()
method
setData1(value)
           Contains an arbitrary string value that is used to supply additional information about a shape.
methodgetData2()
method
setData2(value)
           Contains an arbitrary string value that is used to supply additional information about a shape.
methodgetData3()
method
setData3(value)
           Contains an arbitrary string value that is used to supply additional information about a shape.
methodgetDel()
method
setDel(value)
           A flag indicating whether the element is deleted locally. A value of 1 indicates that the element is deleted locally. The value of the property is BOOL integer constant.
methodgetDiagram()
method
setDiagram(value)
           Root element of Visio objects hierarchy.
methodgetEvent()
method
setEvent(value)
           Contains elements that specify formulas that control shape events.
methodgetFields()
Contains a collection of Field elements.
methodgetFill()
Contains the current fill formatting values for the shape and the shape's drop shadow, including pattern, foreground color, and background color.
methodgetFillStyle()
method
           StyleSheet from which this shape inherits fill formatting.
methodgetForeign()
Contains elements specifying the width and height of an object from another program used in a Microsoft Visio document. Also includes elements specifying the distance the object's image is offset within its borders.
methodgetForeignData()
Contains a MIME (Multipurpose Internet Mail Extensions) encoded BLOB of picture data, such as Windows metafile, bitmap, or OLE data.
methodgetGeoms()
Contains a collection of Geom elements.
methodgetGroup()
Contains elements that control how you add shapes to a group, move members of a group, and select groups.
methodgetHelp()
Contains elements specifying the Shape element's Help file topic and copyright information.
methodgetHyperlinks()
Contains a collection of Hyperlink elements.
methodgetID()
method
setID(value)
           The unique ID of the element within its parent element.
methodgetImage()
Contains the gamma, brightness, contrast, blur, sharpen, denoise, and transparency values for a bitmap.
methodgetInheritChars()
Contains the char values for the shape inherit by the master shape.
methodgetInheritFill()
Contains the fill formatting values for the shape inherit by the parent style and the master shape.
methodgetInheritGeoms()
Contains the Geoms values for the shape inherit by the master shape.
methodgetInheritGroup()
methodgetInheritLine()
Contains the line formatting values for the shape inherit by the parent style and the master shape.
methodgetInheritParas()
Contains the paras for the shape inherit by the parent style and the master shape.
methodgetInheritProps()
Contains the props for the shape inherit by the master shape.
methodgetInheritTextBlock()
Contains the textblock values for the shape inherit by the parent style and the master shape.
methodgetInheritUsers()
Contains the users for the shape inherit by the master shape.
methodisTextEmpty()
Indicate the shape has text and the text is empty or not.
methodgetLayerMem()
Contains the LayerMember element, which specifies each layer to which the shape is assigned.
methodgetLayout()
Contains elements that control shape placement and connector routing settings.
methodgetLine()
Contains elements that control line attributes for a shape, such as pattern, weight, and color. These elements determine whether the line ends are formatted (for example, with an arrowhead), the size of line end formats, radius of the rounding circle applied to the line, and line cap style (round or square).
methodgetLineStyle()
method
           StyleSheet from which this shape inherits line formatting
methodgetMaster()
method
setMaster(value)
           The Master from which the shape inherits its data.
methodgetMasterShape()
method
           This attribute may only be present in shapes that are members of a group shape, and the group is an instance of a master. The attribute contains an ID that references the corresponding sub-shape in the master.
methodgetMisc()
Contains elements specifying the Shape element's Help file topic and copyright information.
methodgetName()
method
setName(value)
           The name of the element.
methodgetNameU()
method
setNameU(value)
           The universal name of the element.
methodgetOneD()
Determines whether the shape behaves as a one-dimensional (1-D) object. Read-only.
methodgetPage()
method
setPage(value)
           Root element of Visio objects hierarchy.
methodgetParas()
Contains a collection of Para elements.
methodgetParentShape()
method
           Shape's parent.
voidsetPresetTheme(value)
Apply a preset theme to this shape The value of the property is PresetThemeValue integer constant.
voidsetPresetThemeQuickStyle(value)
Apply a preset theme variant quickstyle to this shape The value of the property is PresetQuickStyleValue integer constant.
voidsetPresetThemeVariant(value)
Apply a preset theme variant to this shape The value of the property is PresetThemeVariantValue integer constant.
methodgetProps()
method
setProps(value)
           Contains a collection of Prop elements.
methodgetProtection()
Locking helps prevent inadvertent changes to the shape but does not prevent Microsoft Visio from resetting values in other circumstances. It also does not protect against changes made in the ShapeSheet window.
methodgetRootShape()
Returns the top-level shape of an instance if this shape is part of a master instance. Read-only.
methodgetScratchs()
Contains a collection of Scratch elements.
methodgetShapes()
Contains a collection of Shape elements.
methodgetSmartTagDefs()
Contains a collection of SmartTagDef elements.
methodgetTabsCollection()
Contains a collection of Tab elements.
methodgetText()
method
setText(value)
           Contains the text of a shape.
methodgetTextBlock()
Contains elements that specify the alignment, margins, and default tab stop positions of text in a shape's text block.
methodgetTextStyle()
method
           StyleSheet from which this shape inherits text formatting.
methodgetTextXForm()
Contains elements that specify positioning information about a shape's text block.
methodgetThreeDFormat()
Gets the ThreeDFormat.
methodgetTwoD()
method
setTwoD(value)
           Determines whether the shape behaves as a two-dimensional (2-D) object.
methodgetType()
method
setType(value)
           The type of a shape. It may be one of the following values: Group, Shape, Guide, or Foreign. The value of the property is TypeValue integer constant.
methodgetUniqueID()
A GUID (globally unique identifier) assigned to the shape.
methodgetUsers()
Contains a collection of User elements.
methodgetXForm()
method
setXForm(value)
           Contains elements specifying general positioning information about a shape.
methodgetXForm1D()
method
setXForm1D(value)
           Contains x- and y-coordinates of the begin point and end point of a 1-D shape. This element appears for 1-D shapes only.
methodgetZOrderIndex()
Returns the index of a shape in the z-order except the guide shape.
 
Method Summary
methodbringForward()
Brings the shape forward one position in the z-order.
methodbringToFront()
Brings the shape to the front of the z-order.
methodcenterDrawing()
Center the shape with respect to the extent of the page
methodconnectedShapes(flag, categoryFilter)
Returns an array that contains the identifiers (IDs) of the shapes that are connected to the shape.
methodconvertToGroup()
Converts a selection or an object from another application (a linked or embedded object) to a group.
methodcopy(source)
methoddependsOnShapes()
Returns an array that contains the identifiers of the shapes that are depends on a shape.
methodgetConnectorRule()
Returns a connectorRule that contains the shape id and connecton that are connected to the shape.
methodgetConnectorsType()
Get Connectors type
methodgetDisplayText()
Get the text displayed on the interface
methodgetPureText()
Get the text string
methodgetRelationFlag(shape)
Returns RelationFlag that represents the relationship of one shape to another shape.
methodgetRelationShapeCollection()
Returns RelationShapeCollection that represents the relationshapes of one shape.
methodgluedShapes(flag, categoryFilter, otherShape)
Returns an array that contains the identifiers of the shapes that are glued to a shape.
methodisConnected(shape)
Indicates whether this two shapes are connected.
methodisContain(shape)
Indicates whether this shape is contain another shape.
methodisGlued(shape)
Indicates whether this two shapes are glued.
methodisInGroup()
Indicates whether this shape is in a group shape.
methodisIntersect(shape)
Indicates whether this shape is intersect another shape.
methodmove(dX, dY)
Moves shape on the dX and dY inches from current position.
methodmoveTo(newPinX, newPinY)
Moves shape on new absolute position on the page.
methodrefreshData()
Refreshes shape's position including xform ,connection and geom when changing shape's text or other's .
methodreplaceText(text, replaceText)
Replace the text string of a shape .
methodsendBackward()
Moves the shape back one position in the z-order.
methodsendToBack()
Moves the shape to the back of the z-order.
methodsetAngle(angle)
Sets new angle of shape. The angle's unit is radian.
methodsetConnectorsType(type)
Set Connectors type
methodsetHeight(height)
Sets new height of shape.
methodsetPresetThemeStyleMatrics(styleIndex, colorIndex)
pply a preset theme variant quickstyle to this shape, like theme styles options in shape styles dropdown list
methodsetWidth(width)
Sets new width of shape.
methodtoPdf(fileName)
Saves the shape to a pdf file.
methodungroup()
Ungroup Shape
 

    • Constructor Detail

      • Shape

        Shape()
        Constructor.
    • Property Getters/Setters Detail

      • getID/setID : long 

        long getID() / setID(value)
        
        The unique ID of the element within its parent element.
      • getDel/setDel : int 

        int getDel() / setDel(value)
        
        A flag indicating whether the element is deleted locally. A value of 1 indicates that the element is deleted locally. The value of the property is BOOL integer constant.
      • getUniqueID : UUID 

        UUID getUniqueID()
        
        A GUID (globally unique identifier) assigned to the shape.
      • 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.
      • getType/setType : int 

        int getType() / setType(value)
        
        The type of a shape. It may be one of the following values: Group, Shape, Guide, or Foreign. The value of the property is TypeValue integer constant.
      • getLineStyle/setLineStyle : StyleSheet 

        StyleSheet getLineStyle() / setLineStyle(value)
        
        StyleSheet from which this shape inherits line formatting
      • getFillStyle/setFillStyle : StyleSheet 

        StyleSheet getFillStyle() / setFillStyle(value)
        
        StyleSheet from which this shape inherits fill formatting.
      • getTextStyle/setTextStyle : StyleSheet 

        StyleSheet getTextStyle() / setTextStyle(value)
        
        StyleSheet from which this shape inherits text formatting.
      • getText/setText : Text 

        Text getText() / setText(value)
        
        Contains the text of a shape.
      • getXForm/setXForm : XForm 

        XForm getXForm() / setXForm(value)
        
        Contains elements specifying general positioning information about a shape.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("RetrieveShapeInfo.vsd");
        
        // Find a particular shape and update its foreground color and background color
        for (it = diagram.getPages().get(0).getShapes().iterator(); it.hasNext();) {
            shape = it.next();
            if (shape.getNameU().toLowerCase() == "process") {
                shape.getXForm().getPinX().setValue(5);
                shape.getXForm().getPinY().setValue(5);
            }
        }
        
        diagram.save("out-SetXFormdata.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • getLine : Line 

        Line getLine()
        
        Contains elements that control line attributes for a shape, such as pattern, weight, and color. These elements determine whether the line ends are formatted (for example, with an arrowhead), the size of line end formats, radius of the rounding circle applied to the line, and line cap style (round or square).

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("RetrieveShapeInfo.vsd");
        
        // get a shape by id
        shape = diagram.getPages().getPage("Page-2").getShapes().getShape(1);
        
        // set line dash type by index
        shape.getLine().getLinePattern().setValue(4);
        // set line weight, defualt in PT
        shape.getLine().getLineWeight().setValue(2);
        // set color of the shape's line
        shape.getLine().getLineColor().getUfe().setF("RGB(95,108,53)");
        // set line rounding, default in inch
        shape.getLine().getRounding().setValue(0.3125);
        // set line caps
        shape.getLine().getLineCap().setValue(aspose.diagram.BOOL.TRUE);
        // set line color transparency in percent
        shape.getLine().getLineColorTrans().setValue(50);
        
        // add arrows to the connector or curve shapes
        // select arrow type by index
        shape.getLine().getBeginArrow().setValue(4);
        shape.getLine().getEndArrow().setValue(4);
        // set arrow size
        shape.getLine().getBeginArrowSize().setValue(aspose.diagram.ArrowSizeValue.SMALL);
        shape.getLine().getBeginArrowSize().setValue(aspose.diagram.ArrowSizeValue.SMALL);
        
        diagram.save("out-SetLineData.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • getFill : Fill 

        Fill getFill()
        
        Contains the current fill formatting values for the shape and the shape's drop shadow, including pattern, foreground color, and background color.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("RetrieveShapeInfo.vsd");
        
        // Find a particular shape and update its foreground color and background color
        for (it = diagram.getPages().get(0).getShapes().iterator(); it.hasNext();) {
            shape = it.next();
            if (shape.getNameU().toLowerCase() == "process") {
                shape.getFill().getFillForegnd().setValue("#ebf8df");
                shape.getFill().getFillBkgnd().setValue("#dff8eb");
            }
        }
        
        diagram.save("out-SetFillData.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • getInheritGroup : Group 

        Group getInheritGroup()
        
      • getInheritParas : ParaCollection 

        ParaCollection getInheritParas()
        
        Contains the paras for the shape inherit by the parent style and the master shape.
      • getInheritTextBlock : TextBlock 

        TextBlock getInheritTextBlock()
        
        Contains the textblock values for the shape inherit by the parent style and the master shape.
      • getInheritLine : Line 

        Line getInheritLine()
        
        Contains the line formatting values for the shape inherit by the parent style and the master shape.
      • getInheritFill : Fill 

        Fill getInheritFill()
        
        Contains the fill formatting values for the shape inherit by the parent style and the master shape.
      • getXForm1D/setXForm1D : XForm1D 

        XForm1D getXForm1D() / setXForm1D(value)
        
        Contains x- and y-coordinates of the begin point and end point of a 1-D shape. This element appears for 1-D shapes only.
      • getEvent/setEvent : Event 

        Event getEvent() / setEvent(value)
        
        Contains elements that specify formulas that control shape events.
      • getLayerMem : LayerMem 

        LayerMem getLayerMem()
        
        Contains the LayerMember element, which specifies each layer to which the shape is assigned.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("Layers.vsdx");
        shapes = diagram.getPages().getPage("Page-1").getShapes();
        // iterate through the shapes
        for (var it = shapes.iterator(); it.hasNext();) {
            shape = it.next();
            if (shape.getName().toLowerCase() == "shape1") {
                // Add shape1 in first two layers. Here "0;1" are indexes of the
                // layers
                layer = shape.getLayerMem();
                layer.getLayerMember().setValue("0;1");
            } else if (shape.getName().toLowerCase() == "shape2") {
                // Remove shape2 from all the layers
                layer = shape.getLayerMem();
                layer.getLayerMember().setValue("");
            } else if (shape.getName().toLowerCase() == "shape3") {
                // Add shape3 in first layer. Here "0" is index of the first
                // layer
                layer = shape.getLayerMem();
                layer.getLayerMember().setValue("0");
            }
        }
        // save diagram
        diagram.save("out-ConfigureShapeLayers.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • getForeign : Foreign 

        Foreign getForeign()
        
        Contains elements specifying the width and height of an object from another program used in a Microsoft Visio document. Also includes elements specifying the distance the object's image is offset within its borders.
      • getTextBlock : TextBlock 

        TextBlock getTextBlock()
        
        Contains elements that specify the alignment, margins, and default tab stop positions of text in a shape's text block.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("TextBoxes.vsdx");
        
        // get the page by its name
        page1 = diagram.getPages().getPage("Page-1");
        // get shape by its ID
        shape = page1.getShapes().getShape(1);
        // set orientation angle
        margin = new aspose.diagram.DoubleValue(4, aspose.diagram.MeasureConst.PT);
        
        // set left, right, top and bottom margins of the shape's text block
        shape.getTextBlock().setLeftMargin(margin);
        shape.getTextBlock().setRightMargin(margin);
        shape.getTextBlock().setTopMargin(margin);
        shape.getTextBlock().setBottomMargin(margin);
        
        // set the text direction
        shape.getTextBlock().getTextDirection().setValue(aspose.diagram.TextDirectionValue.VERTICAL);
        // set the text alignment
        shape.getTextBlock().getVerticalAlign().setValue(aspose.diagram.VerticalAlignValue.MIDDLE);
        // set the text block background color
        shape.getTextBlock().getTextBkgnd().getUfe().setF("RGB(95,108,53)");
        // set the background color transparency in percent
        shape.getTextBlock().getTextBkgndTrans().setValue(50);
        // set the distance between default tab stops for the selected shape.
        shape.getTextBlock().getDefaultTabStop().setValue(2);
            
        diagram.save("out-FormatShapeTextBlockSection.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • getTextXForm : TextXForm 

        TextXForm getTextXForm()
        
        Contains elements that specify positioning information about a shape's text block.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("TextBoxes.vsdx");
        
        // get shape
        shape = diagram.getPages().getPage("Page-1").getShapes().getShape(1);
        
        // set text position at the bottom,
        // TxtLocPinY = "TxtHeight*1" and TxtPinY = "Height*0"
        shape.getTextXForm().getTxtLocPinY().setValue(shape.getTextXForm().getTxtHeight().getValue());
        shape.getTextXForm().getTxtPinY().setValue(0);
        
        // set orientation angle
        angleDeg = 0;
        angleRad = (Math.PI / 180) * angleDeg;
        shape.getTextXForm().getTxtAngle().setValue(angleRad);
            
        diagram.save("out-SetShapeTextPositionAtBottom.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • getAlign : Align 

        Align getAlign()
        
        Indicates the alignment of a shape with respect to the guide or guide point to which the shape is glued. The Align element appears only for shapes that are glued to guides or guide points.
      • getProtection : Protection 

        Protection getProtection()
        
        Locking helps prevent inadvertent changes to the shape but does not prevent Microsoft Visio from resetting values in other circumstances. It also does not protect against changes made in the ShapeSheet window.
      • getHelp : Help 

        Help getHelp()
        
        Contains elements specifying the Shape element's Help file topic and copyright information.
      • getMisc : Misc 

        Misc getMisc()
        
        Contains elements specifying the Shape element's Help file topic and copyright information.
      • getImage : Image 

        Image getImage()
        
        Contains the gamma, brightness, contrast, blur, sharpen, denoise, and transparency values for a bitmap.
      • getGroup : Group 

        Group getGroup()
        
        Contains elements that control how you add shapes to a group, move members of a group, and select groups.
      • getLayout : Layout 

        Layout getLayout()
        
        Contains elements that control shape placement and connector routing settings.
      • getChars : CharCollection 

        CharCollection getChars()
        
        Contains a collection of Char elements.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("ApplyFontOnText.vsdx");
        
        sourceShape = null;
        // get page by name
        page = diagram.getPages().getPage("Page-1");
        // get shape by ID
        shape = page.getShapes().getShape(1);
        // clear shape text values and chars
        shape.getText().getValue().clear();
        shape.getChars().clear();
        
        // mark character run and add text
        shape.getText().getValue().add(new aspose.diagram.Cp(0));
        shape.getText().getValue().add(new aspose.diagram.Txt("TextStyle_Regular\n"));
        shape.getText().getValue().add(new aspose.diagram.Cp(1));
        shape.getText().getValue().add(new aspose.diagram.Txt("TextStyle_Bold_Italic\n"));
        shape.getText().getValue().add(new aspose.diagram.Cp(2));
        shape.getText().getValue().add(new aspose.diagram.Txt("TextStyle_Underline_Italic\n"));
        shape.getText().getValue().add(new aspose.diagram.Cp(3));
        shape.getText().getValue().add(new aspose.diagram.Txt("TextStyle_Bold_Italic_Underline"));
        
        // add formatting characters
        shape.getChars().add(new aspose.diagram.Char());
        shape.getChars().add(new aspose.diagram.Char());
        shape.getChars().add(new aspose.diagram.Char());
        shape.getChars().add(new aspose.diagram.Char());
        
        // set properties e.g. color, font, size and style etc.
        shape.getChars().get(0).setIX(0);
        shape.getChars().get(0).getColor().setValue("#FF0000");
        shape.getChars().get(0).getFont().setValue(4);
        shape.getChars().get(0).getSize().setValue(0.22);
        shape.getChars().get(0).getStyle().setValue(aspose.diagram.StyleValue.UNDEFINED);
        
        // set properties e.g. color, font, size and style etc.
        shape.getChars().get(1).setIX(1);
        shape.getChars().get(1).getColor().setValue("#FF00FF");
        shape.getChars().get(1).getFont().setValue(4);
        shape.getChars().get(1).getSize().setValue(0.22);
        shape.getChars().get(1).getStyle().setValue(aspose.diagram.StyleValue.BOLD |aspose.diagram. StyleValue.ITALIC);
        
        // set properties e.g. color, font, size and style etc.
        shape.getChars().get(2).setIX(2);
        shape.getChars().get(2).getColor().setValue("#00FF00");
        shape.getChars().get(2).getFont().setValue(4);
        shape.getChars().get(2).getSize().setValue(0.22);
        shape.getChars().get(2).getStyle().setValue(aspose.diagram.StyleValue.UNDERLINE | aspose.diagram.StyleValue.ITALIC);
        
        // set properties e.g. color, font, size and style etc.
        shape.getChars().get(3).setIX(3);
        shape.getChars().get(3).getColor().setValue("#3333FF");
        shape.getChars().get(3).getFont().setValue(4);
        shape.getChars().get(3).getSize().setValue(0.22);
        shape.getChars().get(3).getStyle().setValue(aspose.diagram.StyleValue.BOLD | aspose.diagram.StyleValue.ITALIC | aspose.diagram.StyleValue.UNDERLINE);
        
        diagram.save("out-ApplyFontOnText.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • getUsers : UserCollection 

        UserCollection getUsers()
        
        Contains a collection of User elements.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("TextBoxes.vsdx");
        
        // get page by name
        page = diagram.getPages().getPage("Page-1");
        // get shape by id
        shape = page.getShapes().getShape(2);
        // extract user defined cells of the shape
        for (it = shape.getUsers().iterator(); it.hasNext();) {
            user = it.next();
            console.log(user.getName() + ": " + user.getValue().getVal());
        }
      • getHyperlinks : HyperlinkCollection 

        HyperlinkCollection getHyperlinks()
        
        Contains a collection of Hyperlink elements.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("Hyperlinks.vsdx");
        
        // get page by name
        var page = diagram.getPages().getPage("Page-1");
        // get shape by ID
        var shape = page.getShapes().getShape(1);
        // get hyperlink collection
        var hyperlinks = shape.getHyperlinks();
        // iterate through the hyperlinks
        for (var it = hyperlinks.iterator(); it.hasNext();) {
            hyperlink = it.next();
            console.log("Address: " + hyperlink.getAddress().getValue());
            console.log("Sub Address: " + hyperlink.getSubAddress().getValue());
            console.log("Description: " + hyperlink.getDescription().getValue());
        }
      • getData1/setData1 : String 

        String getData1() / setData1(value)
        
        Contains an arbitrary string value that is used to supply additional information about a shape.
      • getData2/setData2 : String 

        String getData2() / setData2(value)
        
        Contains an arbitrary string value that is used to supply additional information about a shape.
      • getData3/setData3 : String 

        String getData3() / setData3(value)
        
        Contains an arbitrary string value that is used to supply additional information about a shape.
      • getClippingPath/setClippingPath : String 

        String getClippingPath() / setClippingPath(value)
        
      • getForeignData : ForeignData 

        ForeignData getForeignData()
        
        Contains a MIME (Multipurpose Internet Mail Extensions) encoded BLOB of picture data, such as Windows metafile, bitmap, or OLE data.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        fs = require("fs");
        
        diagram = new aspose.diagram.Diagram("ExtractAllImagesFromPage.vsd");
        
        // Enter page index i.e. 0 for first one
        for (var it = diagram.getPages().getPage(0).getShapes().iterator(); it.hasNext();) {
            shape = it.next();
            // Filter shapes by type Foreign
            if (shape.getType() == aspose.diagram.TypeValue.FOREIGN) {
                output = fs.writeFileSync("out" + shape.getID() + ".bmp", shape.getForeignData().getValue());
            }
        }
      • getMasterShape/setMasterShape : Shape 

        Shape getMasterShape() / setMasterShape(value)
        
        This attribute may only be present in shapes that are members of a group shape, and the group is an instance of a master. The attribute contains an ID that references the corresponding sub-shape in the master.
      • getMaster/setMaster : Master 

        Master getMaster() / setMaster(value)
        
        The Master from which the shape inherits its data.
      • getParentShape/setParentShape : Shape 

        Shape getParentShape() / setParentShape(value)
        
        Shape's parent.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("AddingNewShape.vsdx");
        
        // get a sub-shape by page name, group shape ID, and then sub-shape ID
        shape = diagram.getPages().getPage("Page-3").getShapes().getShape(13).getShapes().getShape(2);
        parentShape = shape.getParentShape();
        console.log("Parent Shape's Properties:");
        console.log("Shape ID: " + parentShape.getID());
        console.log("Shape Name: " + parentShape.getName());
        console.log("Shape Type: " + parentShape.getType());
      • getRootShape : Shape 

        Shape getRootShape()
        
        Returns the top-level shape of an instance if this shape is part of a master instance. Read-only.
      • getDiagram/setDiagram : Diagram 

        Diagram getDiagram() / setDiagram(value)
        
        Root element of Visio objects hierarchy.
      • getPage/setPage : Page 

        Page getPage() / setPage(value)
        
        Root element of Visio objects hierarchy.
      • getOneD : boolean 

        boolean getOneD()
        
        Determines whether the shape behaves as a one-dimensional (1-D) object. Read-only.
      • getTwoD/setTwoD : boolean 

        boolean getTwoD() / setTwoD(value)
        
        Determines whether the shape behaves as a two-dimensional (2-D) object.
      • isTextEmpty : boolean 

        boolean isTextEmpty()
        
        Indicate the shape has text and the text is empty or not.
      • getControlData : byte[] 

        byte[] getControlData()
        
        Gets the data of control.
      • getActiveXControl : ActiveXControl 

        ActiveXControl getActiveXControl()
        
        Gets the ActiveX control.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("VisioActiveXControls.vsdx");
        
        // get a Visio page by name
        page = diagram.getPages().getPage("Page-1");
        // get a shape by ID
        shape = page.getShapes().getShape(1);
        // get an ActiveX control
        activex = shape.getActiveXControl();
        // set width of the command button control
        activex.setWidth(4);
        // set height of the command button control
        activex.setHeight(4);
        // set caption of the command button control
        activex.setCaption("Test Button");
            
        diagram.save("out-RetrieveActiveXControl.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • getZOrderIndex : int 

        int getZOrderIndex()
        
        Returns the index of a shape in the z-order except the guide shape.
      • setPresetTheme : int 

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

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

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

      • copy

         copy(source)
      • bringForward

         bringForward()
        Brings the shape forward one position in the z-order.
      • sendBackward

         sendBackward()
        Moves the shape back one position in the z-order.
      • bringToFront

         bringToFront()
        Brings the shape to the front of the z-order.
      • sendToBack

         sendToBack()
        Moves the shape to the back of the z-order.
      • getConnectorRule

        ConnectorRule getConnectorRule()
        Returns a connectorRule that contains the shape id and connecton that are connected to the shape.
        Returns:
        ConnectorRule.
      • connectedShapes

        long[] connectedShapes(flag, categoryFilter)
        Returns an array that contains the identifiers (IDs) of the shapes that are connected to the shape.
        Parameters:
        flag: int - A ConnectedShapesFlags value. Filters the array of returned shape IDs by the directionality of the connectors. See Remarks for possible valuesConnectedShapesFlags.
        categoryFilter: String - Filters the array of returned shape IDs by limiting it to the IDs of shapes that match the specified categoryjava.lang.String.
        Returns:
        IDs arraylong.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("AddingNewShape.vsdx");
        
        // get shape by id
        shape = diagram.getPages().getPage("Page-3").getShapes().getShape(16);
        // get connected shapes
        connectedShapeIds = shape.connectedShapes(aspose.diagram.ConnectedShapesFlags.CONNECTED_SHAPES_ALL_NODES, null);
        
        for (let i = 0; i < connectedShapeIds.length; i++) {
            shape = diagram.getPages().getPage("Page-3").getShapes().getShape(connectedShapeIds[i]);
            console.log("ID: " + shape.getID() + "\t\t Name: " + shape.getName());
        }
      • isInGroup

        boolean isInGroup()
        Indicates whether this shape is in a group shape.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("AddingNewShape.vsdx");
        
        // get a sub-shape by page name, group shape ID, and then sub-shape ID
        shape = diagram.getPages().getPage("Page-3").getShapes().getShape(13).getShapes().getShape(2);
        console.log("Is it in a Group: " + shape.isInGroup());
      • isContain

        boolean isContain(shape)
        Indicates whether this shape is contain another shape.
      • isIntersect

        boolean isIntersect(shape)
        Indicates whether this shape is intersect another shape.
      • isConnected

        boolean isConnected(shape)
        Indicates whether this two shapes are connected.
        Parameters:
        shape: Shape - shape

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("RetrieveShapeInfo.vsd");
        
        // get Visio page by name
        page = diagram.getPages().getPage("Page-2");
        
        // get Visio shapes by ids
        ShapedOne = page.getShapes().getShape(1);
        ShapedTwo = page.getShapes().getShape(2);
        
        // determine whether shapes are connected
        connected = ShapedOne.isConnected(ShapedTwo);
        console.log("Shapes are connected: " + connected);
        
        // determine whether shapes are glued
        glued = ShapedOne.isGlued(ShapedTwo);
        console.log("Shapes are Glued: " + glued);
      • centerDrawing

         centerDrawing()
        Center the shape with respect to the extent of the page
      • isGlued

        boolean isGlued(shape)
        Indicates whether this two shapes are glued.
        Parameters:
        shape: Shape - shape
      • refreshData

         refreshData()
        Refreshes shape's position including xform ,connection and geom when changing shape's text or other's . We will gather shape's data such as shape's text then calculate shape's position. This method is only used to refresh shape's data .

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("AddingNewShape.vsdx");
        
        // get page by name
        page = diagram.getPages().getPage("Page-2");
        
        // Add master with stencil file path and master id
        masterName = "Rectangle";
        // Add master with stencil file path and master name
        diagram.addMaster("BasicShapes.vss", masterName);
        
        // page indexing starts from 0
        PageIndex = 1;
        width = 2, height = 2, pinX = 4.25, pinY = 4.5;
        // Add a new rectangle shape
        rectangleId = diagram.addShape(pinX, pinY, width, height, masterName, PageIndex);
        
        // set shape properties
        rectangle = page.getShapes().getShape(rectangleId);
        rectangle.getXForm().getPinX().setValue(5);
        rectangle.getXForm().getPinY().setValue(5);
        rectangle.setType(aspose.diagram.TypeValue.SHAPE);
        rectangle.getText().getValue().add(new aspose.diagram.Txt("Aspose Diagram"));
        rectangle.setTextStyle(diagram.getStyleSheets().get(3));
        rectangle.getLine().getLineColor().setValue("#ff0000");
        rectangle.getLine().getLineWeight().setValue(0.03);
        rectangle.getLine().getRounding().setValue(0.1);
        rectangle.getFill().getFillBkgnd().setValue("#ff00ff");
        rectangle.getFill().getFillForegnd().setValue("#ebf8df");
        
        rectangle.refreshData();
        
        diagram.save("out-AddShape.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • gluedShapes

        long[] gluedShapes(flag, categoryFilter, otherShape)
        Returns an array that contains the identifiers of the shapes that are glued to a shape.
        Parameters:
        flag: int - A GluedShapesFlags value. The dimensionality and directionality of the connection points of the shapes to return.See Remarks for possible valuesGluedShapesFlags.
        categoryFilter: String - Filters the array of returned shape IDs by limiting it to the IDs of shapes that match the specified categoryjava.lang.String.
        otherShape: Shape - Optional: additional shape to which returned shapes must also be glued, can be Shape or null.
        Returns:
        IDs arraylong.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("RetrieveShapeInfo.vsd");
        
        // get shape by an ID
        shape = diagram.getPages().getPage("Page-2").getShapes().getShape(1);
        // get all glued 1D shapes
        gluedShapeIds = shape.gluedShapes(aspose.diagram.GluedShapesFlags.GLUED_SHAPES_ALL_1_D, null, null);
        
        // display shape ID and name
        for (let i = 0; i < gluedShapeIds.length; i++) {
            shape = diagram.getPages().get(0).getShapes().getShape(gluedShapeIds[i]);
            console.log("ID: " + shape.getID() + "\t\t Name: " + shape.getName());
        }
      • dependsOnShapes

        long[] dependsOnShapes()
        Returns an array that contains the identifiers of the shapes that are depends on a shape.
        Returns:
        IDs arraylong.
      • setWidth

         setWidth(width)
        Sets new width of shape.
        Parameters:
        width: float - New widthdouble.
      • setHeight

         setHeight(height)
        Sets new height of shape.
        Parameters:
        height: float - New heightdouble.
      • setAngle

         setAngle(angle)
        Sets new angle of shape. The angle's unit is radian.
        Parameters:
        angle: float - New angle which unit is radian not degreedouble.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("RetrieveShapeInfo.vsd");
        
        shape = diagram.getPages().getPage("Page-2").getShapes().getShape(2);
        
        // Add a shape and set the angle
        shape.setAngle(190);
        
        diagram.save("out-RotateVisioShape.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • moveTo

         moveTo(newPinX, newPinY)
        Moves shape on new absolute position on the page.
        Parameters:
        newPinX: float - New x-coordinate of the shape's pin (center of rotation) in relation to the origin of its parent.double.
        newPinY: float - New y-coordinate of the shape's pin (center of rotation) in relation to the origin of its parent.double.
      • move

         move(dX, dY)
        Moves shape on the dX and dY inches from current position.
        Parameters:
        dX: float - X offsetdouble.
        dY: float - Y offsetdouble.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("GroupShapes.vsdx");
        
        // get page by name
        page = diagram.getPages().getPage("Page-3");
        // get shape by id
        shape = page.getShapes().getShape(16);
        // move shape from its position, it adds values in coordinates
        shape.move(1, 1);
        
        diagram.save("out-MoveVisioShape.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • getDisplayText

        String getDisplayText()
        Get the text displayed on the interface
      • getPureText

        String getPureText()
        Get the text string
      • ungroup

         ungroup()
        Ungroup Shape
      • replaceText

         replaceText(text, replaceText)
        Replace the text string of a shape .
      • toPdf

         toPdf(fileName)
        Saves the shape to a pdf file.
        Parameters:
        fileName: String - the pdf file name with full path
      • convertToGroup

         convertToGroup()
        Converts a selection or an object from another application (a linked or embedded object) to a group.
      • getConnectorsType

        int getConnectorsType()
        Get Connectors type
      • setConnectorsType

         setConnectorsType(type)
        Set Connectors type
        Parameters:
        type - A ConnectorsTypeValue value.

        Example:

        var aspose = aspose || {};
        aspose.diagram = require("aspose.diagram");
        
        diagram = new aspose.diagram.Diagram("RetrieveShapeInfo.vsd");
        
        // get a dynamic connector type shape by id
        shape = diagram.getPages().getPage("Page-2").getShapes().getShape(3);
        
        // set dynamic connector appearance
        shape.setConnectorsType(aspose.diagram.ConnectorsTypeValue.STRAIGHT_LINES);
        
        diagram.save("out-SetConnectorAppearance.vsdx", aspose.diagram.SaveFileFormat.VSDX);
      • getRelationFlag

        int getRelationFlag(shape)
        Returns RelationFlag that represents the relationship of one shape to another shape.
      • getRelationShapeCollection

        RelationShapeCollection getRelationShapeCollection()
        Returns RelationShapeCollection that represents the relationshapes of one shape.
      • setPresetThemeStyleMatrics

         setPresetThemeStyleMatrics(styleIndex, colorIndex)
        pply a preset theme variant quickstyle to this shape, like theme styles options in shape styles dropdown list
        Parameters:
        styleIndex: int - A PresetStyleMatricsValue value. the row of style matrics
        colorIndex: int - A PresetColorMatricsValue value. the column of style matrics