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 | ||
---|---|---|
function | getActiveXControl() | |
Gets the ActiveX control. | ||
function | getActs() | |
Contains a collection of Act elements. | ||
function | 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. | ||
function | getChars() | |
Contains a collection of Char elements. | ||
function | getConnectionABCDs() | |
Contains a collection of ConnectionABCD elements. | ||
function | getConnections() | |
Contains a collection of Connection elements. | ||
function | getControlData() | |
Gets the data of control. | ||
function | getControls() | |
Contains a collection of Control elements. | ||
function | getData1() | |
function | setData1(value) | |
Contains an arbitrary string value that is used to supply additional information about a shape. | ||
function | getData2() | |
function | setData2(value) | |
Contains an arbitrary string value that is used to supply additional information about a shape. | ||
function | getData3() | |
function | setData3(value) | |
Contains an arbitrary string value that is used to supply additional information about a shape. | ||
function | getDel() | |
function | 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. | ||
function | getDiagram() | |
function | setDiagram(value) | |
Root element of Visio objects hierarchy. | ||
function | getEvent() | |
function | setEvent(value) | |
Contains elements that specify formulas that control shape events. | ||
function | getFields() | |
Contains a collection of Field elements. | ||
function | getFill() | |
Contains the current fill formatting values for the shape and the shape's drop shadow, including pattern, foreground color, and background color. | ||
function | getFillStyle() | |
function | setFillStyle(value) | |
StyleSheet from which this shape inherits fill formatting. | ||
function | 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. | ||
function | getForeignData() | |
Contains a MIME (Multipurpose Internet Mail Extensions) encoded BLOB of picture data, such as Windows metafile, bitmap, or OLE data. | ||
function | getGeoms() | |
Contains a collection of Geom elements. | ||
function | getGroup() | |
Contains elements that control how you add shapes to a group, move members of a group, and select groups. | ||
function | getHelp() | |
Contains elements specifying the Shape element's Help file topic and copyright information. | ||
function | getHyperlinks() | |
Contains a collection of Hyperlink elements. | ||
function | getID() | |
function | setID(value) | |
The unique ID of the element within its parent element. | ||
function | getImage() | |
Contains the gamma, brightness, contrast, blur, sharpen, denoise, and transparency values for a bitmap. | ||
function | getInheritChars() | |
Contains the char values for the shape inherit by the master shape. | ||
function | getInheritFill() | |
Contains the fill formatting values for the shape inherit by the parent style and the master shape. | ||
function | getInheritLine() | |
Contains the line formatting values for the shape inherit by the parent style and the master shape. | ||
function | getInheritProps() | |
Contains the props for the shape inherit by the master shape. | ||
function | getInheritUsers() | |
Contains the users for the shape inherit by the master shape. | ||
function | isTextEmpty() | |
Indicate the shape has text and the text is empty or not. | ||
function | getLayerMem() | |
Contains the LayerMember element, which specifies each layer to which the shape is assigned. | ||
function | getLayout() | |
Contains elements that control shape placement and connector routing settings. | ||
function | 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). | ||
function | getLineStyle() | |
function | setLineStyle(value) | |
StyleSheet from which this shape inherits line formatting | ||
function | getMaster() | |
function | setMaster(value) | |
The Master from which the shape inherits its data. | ||
function | getMasterShape() | |
function | 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. | ||
function | getMisc() | |
Contains elements specifying the Shape element's Help file topic and copyright information. | ||
function | getName() | |
function | setName(value) | |
The name of the element. | ||
function | getNameU() | |
function | setNameU(value) | |
The universal name of the element. | ||
function | getOneD() | |
Determines whether the shape behaves as a one-dimensional (1-D) object. Read-only. | ||
function | getPage() | |
function | setPage(value) | |
Root element of Visio objects hierarchy. | ||
function | getParas() | |
Contains a collection of Para elements. | ||
function | getParentShape() | |
function | setParentShape(value) | |
Shape's parent. | ||
function | getProps() | |
function | setProps(value) | |
Contains a collection of Prop elements. | ||
function | 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. | ||
function | getScratchs() | |
Contains a collection of Scratch elements. | ||
function | getShapes() | |
Contains a collection of Shape elements. | ||
function | getSmartTagDefs() | |
Contains a collection of SmartTagDef elements. | ||
function | getTabsCollection() | |
Contains a collection of Tab elements. | ||
function | getText() | |
function | setText(value) | |
Contains the text of a shape. | ||
function | getTextBlock() | |
Contains elements that specify the alignment, margins, and default tab stop positions of text in a shape's text block. | ||
function | getTextStyle() | |
function | setTextStyle(value) | |
StyleSheet from which this shape inherits text formatting. | ||
function | getTextXForm() | |
Contains elements that specify positioning information about a shape's text block. | ||
function | getThreeDFormat() | |
Gets the ThreeDFormat. | ||
function | getTwoD() | |
function | setTwoD(value) | |
Determines whether the shape behaves as a two-dimensional (2-D) object. | ||
function | getType() | |
function | 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. | ||
function | getUniqueID() | |
A GUID (globally unique identifier) assigned to the shape. | ||
function | getUsers() | |
Contains a collection of User elements. | ||
function | getXForm() | |
function | setXForm(value) | |
Contains elements specifying general positioning information about a shape. | ||
function | getXForm1D() | |
function | 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. | ||
function | getZOrderIndex() | |
Returns the index of a shape in the z-order except the guide shape. |
Method Summary | ||
---|---|---|
function | bringForward() | |
Brings the shape forward one position in the z-order. | ||
function | bringToFront() | |
Brings the shape to the front of the z-order. | ||
function | connectedShapes(flag, categoryFilter) | |
Returns an array that contains the identifiers (IDs) of the shapes that are connected to the shape. | ||
function | copy(source) | |
function | getConnectorsType() | |
Get Connectors type | ||
function | gluedShapes(flag, categoryFilter, otherShape) | |
Returns an array that contains the identifiers of the shapes that are glued to a shape. | ||
function | isConnected(shape) | |
Indicates whether this two shapes are connected. | ||
function | isGlued(shape) | |
Indicates whether this two shapes are glued. | ||
function | isInGroup() | |
Indicates whether this shape is in a group shape. | ||
function | isIntersect(shape) | |
Indicates whether this shape is intersect another shape. | ||
function | move(dX, dY) | |
Moves shape on the dX and dY inches from current position. | ||
function | moveTo(newPinX, newPinY) | |
Moves shape on new absolute position on the page. | ||
function | refreshData() | |
Refreshes shape's position including xform ,connection and geom when changing shape's text or other's . | ||
function | sendBackward() | |
Moves the shape back one position in the z-order. | ||
function | sendToBack() | |
Moves the shape to the back of the z-order. | ||
function | setAngle(angle) | |
Sets new angle of shape. The angle's unit is radian. | ||
function | setConnectorsType(type) | |
Set Connectors type | ||
function | setHeight(height) | |
Sets new height of shape. | ||
function | setWidth(width) | |
Sets new width of shape. | ||
function | toHTML(fileName, options) | |
Creates the html and saves it to a file. | ||
function | toImage(imageFile, options) | |
Creates the shape image and saves it to a file. The extension of the file name determines the format of the image. | ||
static function | toImageStream(shape, stream, options) | |
Creates the shape image and saves it to a stream in the specified format. | ||
function | toPdf(fileName) | |
Saves the shape to a pdf file. | ||
static function | toPdfStream(shape, stream) | |
Creates the shape pdf and saves it to a stream. | ||
function | toSvg(imageFile, options) | |
Saves the shape to a svg file. |
Constructor Detail |
---|
function Shape()
Property Getters/Setters Detail |
---|
getID/setID : long | |
function getID() / function setID(value) |
getDel/setDel : Number | |
function getDel() / function setDel(value) |
getUniqueID : UUID | |
function getUniqueID() |
getName/setName : String | |
function getName() / function setName(value) |
getNameU/setNameU : String | |
function getNameU() / function setNameU(value) |
getType/setType : Number | |
function getType() / function setType(value) |
getLineStyle/setLineStyle : StyleSheet | |
function getLineStyle() / function setLineStyle(value) |
getFillStyle/setFillStyle : StyleSheet | |
function getFillStyle() / function setFillStyle(value) |
getTextStyle/setTextStyle : StyleSheet | |
function getTextStyle() / function setTextStyle(value) |
getShapes : ShapeCollection | |
function getShapes() |
getText/setText : Text | |
function getText() / function setText(value) |
getXForm/setXForm : XForm | |
function getXForm() / function 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);
getLine : Line | |
function 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);
getFill : Fill | |
function 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);
getInheritChars : CharCollection | |
function getInheritChars() |
getInheritProps : PropCollection | |
function getInheritProps() |
getInheritUsers : UserCollection | |
function getInheritUsers() |
getInheritLine : Line | |
function getInheritLine() |
getInheritFill : Fill | |
function getInheritFill() |
getXForm1D/setXForm1D : XForm1D | |
function getXForm1D() / function setXForm1D(value) |
getEvent/setEvent : Event | |
function getEvent() / function setEvent(value) |
getLayerMem : LayerMem | |
function 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);
getForeign : Foreign | |
function getForeign() |
getTextBlock : TextBlock | |
function 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);
getTextXForm : TextXForm | |
function 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);
getAlign : Align | |
function getAlign() |
getProtection : Protection | |
function getProtection() |
getHelp : Help | |
function getHelp() |
getMisc : Misc | |
function getMisc() |
getImage : Image | |
function getImage() |
getGroup : Group | |
function getGroup() |
getLayout : Layout | |
function getLayout() |
getChars : CharCollection | |
function 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);
getParas : ParaCollection | |
function getParas() |
getScratchs : ScratchCollection | |
function getScratchs() |
getConnections : ConnectionCollection | |
function getConnections() |
getConnectionABCDs : ConnectionABCDCollection | |
function getConnectionABCDs() |
getFields : FieldCollection | |
function getFields() |
getControls : ControlCollection | |
function getControls() |
getGeoms : GeomCollection | |
function getGeoms() |
getActs : ActCollection | |
function getActs() |
getUsers : UserCollection | |
function 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()); }
getProps/setProps : PropCollection | |
function getProps() / function setProps(value) |
getHyperlinks : HyperlinkCollection | |
function 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()); }
getSmartTagDefs : SmartTagDefCollection | |
function getSmartTagDefs() |
getTabsCollection : TabsCollection | |
function getTabsCollection() |
getData1/setData1 : String | |
function getData1() / function setData1(value) |
getData2/setData2 : String | |
function getData2() / function setData2(value) |
getData3/setData3 : String | |
function getData3() / function setData3(value) |
getForeignData : ForeignData | |
function 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()); } }
getMasterShape/setMasterShape : Shape | |
function getMasterShape() / function setMasterShape(value) |
getMaster/setMaster : Master | |
function getMaster() / function setMaster(value) |
getParentShape/setParentShape : Shape | |
function getParentShape() / function 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());
getDiagram/setDiagram : Diagram | |
function getDiagram() / function setDiagram(value) |
getPage/setPage : Page | |
function getPage() / function setPage(value) |
getOneD : boolean | |
function getOneD() |
getTwoD/setTwoD : boolean | |
function getTwoD() / function setTwoD(value) |
isTextEmpty : boolean | |
function isTextEmpty() |
getControlData : byte[] | |
function getControlData() |
getActiveXControl : ActiveXControl | |
function 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);
getZOrderIndex : Number | |
function getZOrderIndex() |
getThreeDFormat : ThreeDFormat | |
function getThreeDFormat() |
Method Detail |
---|
toPdf | |
function toPdf(fileName) |
fileName: String
- the pdf file name with full pathtoImage | |
function toImage(imageFile, options) |
The format of the image is specified by using the extension of the file name. For example, if you specify "myfile.png", then the image will be saved in the PNG format. The following file extensions are recognized: .bmp, .gif, .png, .jpg, .jpeg, .tiff, .tif, .emf.
imageFile: String
- The image file name with full path.options: ImageSaveOptions
- Addtional image creation optionstoSvg | |
function toSvg(imageFile, options) |
fileName
- the svg file name with full pathtoHTML | |
function toHTML(fileName, options) |
imageFile
- The file name with full path.options: HTMLSaveOptions
- html save optionsgetConnectorsType | |
function getConnectorsType() |
setConnectorsType | |
function setConnectorsType(type) |
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);
copy | |
function copy(source) |
bringForward | |
function bringForward() |
sendBackward | |
function sendBackward() |
bringToFront | |
function bringToFront() |
sendToBack | |
function sendToBack() |
connectedShapes | |
function connectedShapes(flag, categoryFilter) |
flag: Number
- 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()); }
isInGroup | |
function 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());
isIntersect | |
function isIntersect(shape) |
isConnected | |
function 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);
isGlued | |
function isGlued(shape) |
shape: Shape
- shaperefreshData | |
function refreshData() |
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 | |
function gluedShapes(flag, categoryFilter, otherShape) |
flag: Number
- 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()); }
setWidth | |
function setWidth(width) |
width: Number
- New widthsetHeight | |
function setHeight(height) |
height: Number
- New heigthsetAngle | |
function setAngle(angle) |
angle: Number
- 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 | |
function moveTo(newPinX, newPinY) |
newPinX: Number
- New x-coordinate of the shape's pin (center of rotation) in relation to the origin of its parent.newPinY: Number
- New y-coordinate of the shape's pin (center of rotation) in relation to the origin of its parent.move | |
function move(dX, dY) |
dX: Number
- X offsetdY: Number
- 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);
toPdfStream | |
static function toPdfStream(shape, stream) |
shape: Shape
- The shape object to savestream: WritableStream
- The streamExample:
var aspose = aspose || {}; aspose.diagram = require("aspose.diagram"); var fs = require("fs"); var diagram = new aspose.diagram.Diagram("example.vsdx"); var page = diagram.getPages().getPage("Page-1"); var shape = page.getShapes().getShape(1); var writeStream = fs.createWriteStream("output.pdf"); aspose.diagram.Shape.toPdfStream(shape, writeStream);
toImageStream | |
static function toImageStream(shape, stream, options) |
shape: Shape
- The shape object to savestream: WritableStream
- The streamoptions: ImageSaveOptions
- Example:
var aspose = aspose || {}; aspose.diagram = require("aspose.diagram"); var fs = require("fs"); var diagram = new aspose.diagram.Diagram("example.vsdx"); var page = diagram.getPages().getPage("Page-1"); var shape = page.getShapes().getShape(1); var writeStream = fs.createWriteStream("output.png"); var options = new aspose.diagram.ImageSaveOptions(aspose.diagram.SaveFileFormat.PNG); aspose.diagram.Shape.toImageStream(shape, writeStream, options);