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 | ||
---|---|---|
method | getActiveXControl() | |
Gets the ActiveX control.
|
||
method | getActs() | |
Contains a collection of Act elements.
|
||
method | 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.
|
||
method | getChars() | |
Contains a collection of Char elements.
|
||
method | getClippingPath() | |
method | setClippingPath(value) | |
method | getConnectionABCDs() | |
Contains a collection of ConnectionABCD elements.
|
||
method | getConnections() | |
Contains a collection of Connection elements.
|
||
method | getControlData() | |
Gets the data of control.
|
||
method | getControls() | |
Contains a collection of Control elements.
|
||
method | getData1() | |
method | setData1(value) | |
Contains an arbitrary string value that is used to supply additional information about a shape. | ||
method | getData2() | |
method | setData2(value) | |
Contains an arbitrary string value that is used to supply additional information about a shape. | ||
method | getData3() | |
method | setData3(value) | |
Contains an arbitrary string value that is used to supply additional information about a shape. | ||
method | getDel() | |
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. | ||
method | getDiagram() | |
method | setDiagram(value) | |
Root element of Visio objects hierarchy. | ||
method | getEvent() | |
method | setEvent(value) | |
Contains elements that specify formulas that control shape events. | ||
method | getFields() | |
Contains a collection of Field elements.
|
||
method | getFill() | |
Contains the current fill formatting values for the shape and the shape's drop shadow, including pattern, foreground color, and background color.
|
||
method | getFillStyle() | |
method | setFillStyle(value) | |
StyleSheet from which this shape inherits fill formatting. | ||
method | 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.
|
||
method | getForeignData() | |
Contains a MIME (Multipurpose Internet Mail Extensions) encoded BLOB of picture data, such as Windows metafile, bitmap, or OLE data.
|
||
method | getGeoms() | |
Contains a collection of Geom elements.
|
||
method | getGroup() | |
Contains elements that control how you add shapes to a group, move members of a group, and select groups.
|
||
method | hasThemeColor() | |
Gets whether the shape has theme color.
|
||
method | getHelp() | |
Contains elements specifying the Shape element's Help file topic and copyright information.
|
||
method | getHyperlinks() | |
Contains a collection of Hyperlink elements.
|
||
method | getID() | |
method | setID(value) | |
The unique ID of the element within its parent element. | ||
method | getImage() | |
Contains the gamma, brightness, contrast, blur, sharpen, denoise, and transparency values for a bitmap.
|
||
method | getInheritChars() | |
Contains the char values for the shape inherit by the master shape.
|
||
method | getInheritFill() | |
Contains the fill formatting values for the shape inherit by the parent style and the master shape.
|
||
method | getInheritGeoms() | |
Contains the Geoms values for the shape inherit by the master shape.
|
||
method | getInheritGroup() | |
method | getInheritLine() | |
Contains the line formatting values for the shape inherit by the parent style and the master shape.
|
||
method | getInheritParas() | |
Contains the paras for the shape inherit by the parent style and the master shape.
|
||
method | getInheritProps() | |
Contains the props for the shape inherit by the master shape.
|
||
method | getInheritTextBlock() | |
Contains the textblock values for the shape inherit by the parent style and the master shape.
|
||
method | getInheritUsers() | |
Contains the users for the shape inherit by the master shape.
|
||
method | getLayerMem() | |
Contains the LayerMember element, which specifies each layer to which the shape is assigned.
|
||
method | getLayout() | |
Contains elements that control shape placement and connector routing settings.
|
||
method | 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).
|
||
method | getLineStyle() | |
method | setLineStyle(value) | |
StyleSheet from which this shape inherits line formatting | ||
method | getMaster() | |
method | setMaster(value) | |
The Master from which the shape inherits its data. | ||
method | getMasterShape() | |
method | 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. | ||
method | getMisc() | |
Contains elements specifying the Shape element's Help file topic and copyright information.
|
||
method | getName() | |
method | setName(value) | |
The name of the element. | ||
method | getNameU() | |
method | setNameU(value) | |
The universal name of the element. | ||
method | getOneD() | |
Determines whether the shape behaves as a one-dimensional (1-D) object. Read-only.
|
||
method | getPage() | |
method | setPage(value) | |
Root element of Visio objects hierarchy. | ||
method | getParas() | |
Contains a collection of Para elements.
|
||
method | getParentShape() | |
method | setParentShape(value) | |
Shape's parent. | ||
void | setPresetTheme(value) | |
Apply a preset theme to this shape
The value of the property is PresetThemeValue integer constant. |
||
void | setPresetThemeQuickStyle(value) | |
Apply a preset theme variant quickstyle to this shape
The value of the property is PresetQuickStyleValue integer constant. |
||
void | setPresetThemeVariant(value) | |
Apply a preset theme variant to this shape
The value of the property is PresetThemeVariantValue integer constant. |
||
method | getProps() | |
method | setProps(value) | |
Contains a collection of Prop elements. | ||
method | 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.
|
||
method | getRootShape() | |
Returns the top-level shape of an instance if this shape is part of a master instance. Read-only.
|
||
method | getScratchs() | |
Contains a collection of Scratch elements.
|
||
method | getShapes() | |
Contains a collection of Shape elements.
|
||
method | getSmartTagDefs() | |
Contains a collection of SmartTagDef elements.
|
||
method | getTabsCollection() | |
Contains a collection of Tab elements.
|
||
method | getText() | |
method | setText(value) | |
Contains the text of a shape. | ||
method | getTextBlock() | |
Contains elements that specify the alignment, margins, and default tab stop positions of text in a shape's text block.
|
||
method | getTextStyle() | |
method | setTextStyle(value) | |
StyleSheet from which this shape inherits text formatting. | ||
method | getTextXForm() | |
Contains elements that specify positioning information about a shape's text block.
|
||
method | getThreeDFormat() | |
Gets the ThreeDFormat.
|
||
method | getTwoD() | |
method | setTwoD(value) | |
Determines whether the shape behaves as a two-dimensional (2-D) object. | ||
method | getType() | |
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. | ||
method | getUniqueID() | |
A GUID (globally unique identifier) assigned to the shape.
|
||
method | getUsers() | |
Contains a collection of User elements.
|
||
method | getXForm() | |
method | setXForm(value) | |
Contains elements specifying general positioning information about a shape. | ||
method | getXForm1D() | |
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. | ||
method | getZOrderIndex() | |
Returns the index of a shape in the z-order except the guide shape.
|
Method Summary | ||
---|---|---|
method | bringForward() | |
Brings the shape forward one position in the z-order.
|
||
method | bringToFront() | |
Brings the shape to the front of the z-order.
|
||
method | centerDrawing() | |
Center the shape with respect to the extent of the page
|
||
method | connectedShapes(flag, categoryFilter) | |
Returns an array that contains the identifiers (IDs) of the shapes that are connected to the shape.
|
||
method | convertToGroup() | |
Converts a selection or an object from another application (a linked or embedded object) to a group.
|
||
method | copy(source) | |
method | dependsOnShapes() | |
Returns an array that contains the identifiers of the shapes that are depends on a shape.
|
||
method | getConnectorRule() | |
Returns a connectorRule that contains the shape id and connecton that are connected to the shape.
|
||
method | getConnectorsType() | |
Get Connectors type
|
||
method | getDisplayText() | |
Get the text displayed on the interface
|
||
method | getPureText() | |
Get the text string
|
||
method | getRelationFlag(shape) | |
Returns RelationFlag that represents the relationship of one shape to another shape.
|
||
method | getRelationShapeCollection() | |
Returns RelationShapeCollection that represents the relationshapes of one shape.
|
||
method | gluedShapes(flag, categoryFilter, otherShape) | |
Returns an array that contains the identifiers of the shapes that are glued to a shape.
|
||
method | isConnected(shape) | |
Indicates whether this two shapes are connected.
|
||
method | isContain(shape) | |
Indicates whether this shape is contain another shape.
|
||
method | isGlued(shape) | |
Indicates whether this two shapes are glued.
|
||
method | isInGroup() | |
Indicates whether this shape is in a group shape.
|
||
method | isIntersect(shape) | |
Indicates whether this shape is intersect another shape.
|
||
method | move(dX, dY) | |
Moves shape on the dX and dY inches from current position.
|
||
method | moveTo(newPinX, newPinY) | |
Moves shape on new absolute position on the page.
|
||
method | refreshData() | |
Refreshes shape's position including xform ,connection and geom when changing shape's text or other's .
|
||
method | replaceText(text, replaceText) | |
Replace the text string of a shape .
|
||
method | sendBackward() | |
Moves the shape back one position in the z-order.
|
||
method | sendToBack() | |
Moves the shape to the back of the z-order.
|
||
method | setAngle(angle) | |
Sets new angle of shape.
The angle's unit is radian.
|
||
method | setConnectorJumpValue(code, style) | |
Set Jump code value and Jump style value for Connector
|
||
method | setConnectorsType(type) | |
Set Connectors type
|
||
method | setHeight(height) | |
Sets new height of shape.
|
||
method | setPresetThemeStyleMatrics(styleIndex, colorIndex) | |
pply a preset theme variant quickstyle to this shape, like theme styles options in shape styles dropdown list
|
||
method | setWidth(width) | |
Sets new width of shape.
|
||
method | toPdf(fileName) | |
Saves the shape to a pdf file.
|
||
method | ungroup() | |
Ungroup Shape
|
long getID() / setID(value)
int getDel() / setDel(value)
UUID getUniqueID()
String getName() / setName(value)
String getNameU() / setNameU(value)
int getType() / setType(value)
StyleSheet getLineStyle() / setLineStyle(value)
StyleSheet getFillStyle() / setFillStyle(value)
StyleSheet getTextStyle() / setTextStyle(value)
ShapeCollection getShapes()
XForm getXForm() / setXForm(value)
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);
Line getLine()
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);
Fill getFill()
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);
boolean hasThemeColor()
CharCollection getInheritChars()
PropCollection getInheritProps()
UserCollection getInheritUsers()
GeomCollection getInheritGeoms()
ParaCollection getInheritParas()
TextBlock getInheritTextBlock()
Line getInheritLine()
Fill getInheritFill()
XForm1D getXForm1D() / setXForm1D(value)
Event getEvent() / setEvent(value)
LayerMem getLayerMem()
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);
Foreign getForeign()
TextBlock getTextBlock()
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);
TextXForm getTextXForm()
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);
Align getAlign()
Protection getProtection()
Help getHelp()
Misc getMisc()
Image getImage()
Group getGroup()
Layout getLayout()
CharCollection getChars()
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);
ParaCollection getParas()
ScratchCollection getScratchs()
ConnectionCollection getConnections()
ConnectionABCDCollection getConnectionABCDs()
FieldCollection getFields()
ControlCollection getControls()
GeomCollection getGeoms()
ActCollection getActs()
UserCollection getUsers()
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()); }
PropCollection getProps() / setProps(value)
HyperlinkCollection getHyperlinks()
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()); }
SmartTagDefCollection getSmartTagDefs()
TabsCollection getTabsCollection()
String getData1() / setData1(value)
String getData2() / setData2(value)
String getData3() / setData3(value)
String getClippingPath() / setClippingPath(value)
ForeignData getForeignData()
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()); } }
Shape getMasterShape() / setMasterShape(value)
Master getMaster() / setMaster(value)
Shape getParentShape() / setParentShape(value)
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());
Shape getRootShape()
Diagram getDiagram() / setDiagram(value)
boolean getOneD()
boolean getTwoD() / setTwoD(value)
byte[] getControlData()
ActiveXControl getActiveXControl()
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);
int getZOrderIndex()
setPresetTheme(value)
setPresetThemeVariant(value)
setPresetThemeQuickStyle(value)
ThreeDFormat getThreeDFormat()
setPresetThemeStyleMatrics(styleIndex, colorIndex)
styleIndex: int
- A colorIndex: int
- A copy(source)
bringForward()
sendBackward()
bringToFront()
sendToBack()
ConnectorRule getConnectorRule()
long[] connectedShapes(flag, categoryFilter)
flag: int
- A categoryFilter: String
- Filters the array of returned shape IDs by limiting it to the IDs of shapes that match the specified categoryExample:
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()); }
boolean isInGroup()
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());
boolean isContain(shape)
boolean isIntersect(shape)
boolean isConnected(shape)
shape: Shape
- shapeExample:
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()
boolean isGlued(shape)
shape: Shape
- shaperefreshData()
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);
long[] gluedShapes(flag, categoryFilter, otherShape)
flag: int
- A categoryFilter: String
- Filters the array of returned shape IDs by limiting it to the IDs of shapes that match the specified categoryotherShape: Shape
- Optional: additional shape to which returned shapes must also be glued, can be 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()); }
long[] dependsOnShapes()
setWidth(width)
width: float
- New widthsetHeight(height)
height: float
- New heightsetAngle(angle)
angle: float
- New angle which unit is radian not degreeExample:
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(newPinX, newPinY)
newPinX: float
- New x-coordinate of the shape's pin (center of rotation) in relation to the origin of its parent.newPinY: float
- New y-coordinate of the shape's pin (center of rotation) in relation to the origin of its parent.move(dX, dY)
dX: float
- X offsetdY: float
- Y offsetExample:
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);
String getDisplayText()
String getPureText()
ungroup()
replaceText(text, replaceText)
toPdf(fileName)
fileName: String
- the pdf file name with full pathconvertToGroup()
int getConnectorsType()
setConnectorJumpValue(code, style)
code: int
- A style: int
- A setConnectorsType(type)
type: int
- A 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);
int getRelationFlag(shape)
shape: Shape
- ShapeRelationShapeCollection getRelationShapeCollection()