Shape
Shape class
Contains elements that define a shape in a Master, Page, or group shape element.
Constructors
| Name | Description |
|---|---|
| Shape | Constructor. |
Properties
| Name | Type | Description |
|---|---|---|
| ID | long | The unique ID of the element within its parent element. |
| Del | int | A flag indicating whether the element is deleted locally. A value of 1 indicates that the element is deleted locally. Th |
| UniqueID | UUID | A GUID (globally unique identifier) assigned to the shape. |
| Name | String | The name of the element. |
| NameU | String | The universal name of the element. |
| Type | int | The type of a shape. It may be one of the following values: Group, Shape, Guide, or Foreign. The value of the property i |
| LineStyle | StyleSheet | StyleSheet from which this shape inherits line formatting |
| FillStyle | StyleSheet | StyleSheet from which this shape inherits fill formatting. |
| TextStyle | StyleSheet | StyleSheet from which this shape inherits text formatting. |
| Shapes | ShapeCollection | Contains a collection of Shape elements. |
| Text | Text | Contains the text of a shape. |
| XForm | XForm | Contains elements specifying general positioning information about a shape. |
| Line | Line | Contains elements that control line attributes for a shape, such as pattern, weight, and color. These elements determine |
| Fill | Fill | Contains the current fill formatting values for the shape and the shape’s drop shadow, including pattern, foreground col |
| HasThemeColor | boolean | Gets whether the shape has theme color. |
| InheritChars | CharCollection | Contains the char values for the shape inherit by the master shape. |
| InheritProps | PropCollection | Contains the props for the shape inherit by the master shape. |
| InheritFields | FieldCollection | Contains the fields for the shape inherit by the master shape. |
| InheritActs | ActCollection | Contains the actions for the shape inherit by the master shape. |
| InheritHyperlinks | HyperlinkCollection | Contains the Hyperlinks for the shape inherit by the master shape. |
| InheritXForm | XForm | |
| InheritXForm1D | XForm1D | |
| InheritMisc | Misc | Contains the Misc for the shape inherit by the master shape. |
| InheritProtection | Protection | Contains the Protection for the shape inherit by the master shape. |
| InheritEvent | Event | Contains the Event for the shape inherit by the master shape. |
| InheritLayerMem | LayerMem | Contains the LayerMem for the shape inherit by the master shape. |
| InheritHelp | Help | Contains the Help for the shape inherit by the master shape. |
| InheritLayout | Layout | Contains the Layout for the shape inherit by the master shape. |
| InheritControls | ControlCollection | Contains the controls for the shape inherit by the master shape. |
| InheritConnections | ConnectionCollection | Contains the connections for the shape inherit by the master shape. |
| InheritScratchs | ScratchCollection | Contains the scratchs for the shape inherit by the master shape. |
| InheritGroup | Group | |
| InheritUsers | UserCollection | Contains the users for the shape inherit by the master shape. |
| InheritTextXForm | TextXForm | Contains the textxform values for the shape inherit by the parent style and the master shape. |
| InheritGeoms | GeomCollection | Contains the Geoms values for the shape inherit by the master shape. |
| InheritParas | ParaCollection | Contains the paras for the shape inherit by the parent style and the master shape. |
| InheritTabs | TabsCollection | Contains the tabs for the shape inherit by the parent style and the master shape. |
| InheritTextBlock | TextBlock | Contains the textblock values for the shape inherit by the parent style and the master shape. |
| InheritLine | Line | Contains the line formatting values for the shape inherit by the parent style and the master shape. |
| InheritFill | Fill | Contains the fill formatting values for the shape inherit by the parent style and the master shape. |
| XForm1D | XForm1D | 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. |
| Event | Event | Contains elements that specify formulas that control shape events. |
| LayerMem | LayerMem | Contains the LayerMember element, which specifies each layer to which the shape is assigned. |
| Foreign | Foreign | Contains elements specifying the width and height of an object from another program used in a Microsoft Visio document. |
| TextBlock | TextBlock | Contains elements that specify the alignment, margins, and default tab stop positions of text in a shape’s text block. |
| TextXForm | TextXForm | Contains elements that specify positioning information about a shape’s text block. |
| Align | Align | Indicates the alignment of a shape with respect to the guide or guide point to which the shape is glued. The Align eleme |
| Protection | Protection | Locking helps prevent inadvertent changes to the shape but does not prevent Microsoft Visio from resetting values in oth |
| Help | Help | Contains elements specifying the Shape element’s Help file topic and copyright information. |
| Misc | Misc | Contains elements specifying the Shape element’s Help file topic and copyright information. |
| Image | Image | Contains the gamma, brightness, contrast, blur, sharpen, denoise, and transparency values for a bitmap. |
| Group | Group | Contains elements that control how you add shapes to a group, move members of a group, and select groups. |
| Layout | Layout | Contains elements that control shape placement and connector routing settings. |
| Chars | CharCollection | Contains a collection of Char elements. |
| Paras | ParaCollection | Contains a collection of Para elements. |
| Scratchs | ScratchCollection | Contains a collection of Scratch elements. |
| Connections | ConnectionCollection | Contains a collection of Connection elements. |
| ContainerProperties | ContainerProperties | Contains shape’s ContainerProperties. |
| ConnectionABCDs | ConnectionABCDCollection | Contains a collection of ConnectionABCD elements. |
| Fields | FieldCollection | Contains a collection of Field elements. |
| Controls | ControlCollection | Contains a collection of Control elements. |
| Geoms | GeomCollection | Contains a collection of Geom elements. |
| Acts | ActCollection | Contains a collection of Act elements. |
| Users | UserCollection | Contains a collection of User elements. |
| Props | PropCollection | Contains a collection of Prop elements. |
| Hyperlinks | HyperlinkCollection | Contains a collection of Hyperlink elements. |
| SmartTagDefs | SmartTagDefCollection | Contains a collection of SmartTagDef elements. |
| TabsCollection | TabsCollection | Contains a collection of Tab elements. |
| Data1 | String | Contains an arbitrary string value that is used to supply additional information about a shape. |
| Data2 | String | Contains an arbitrary string value that is used to supply additional information about a shape. |
| Data3 | String | Contains an arbitrary string value that is used to supply additional information about a shape. |
| ClippingPath | String | Contains Clipping Path string value. |
| ForeignData | ForeignData | Contains a MIME (Multipurpose Internet Mail Extensions) encoded BLOB of picture data, such as Windows metafile, bitmap, |
| MasterShape | Shape | This attribute may only be present in shapes that are members of a group shape, and the group is an instance of a master |
| Master | Master | The Master from which the shape inherits its data. |
| ParentShape | Shape | Shape’s parent. |
| RootShape | Shape | Returns the top-level shape of an instance if this shape is part of a master instance. Read-only. |
| Diagram | Diagram | Root element of Visio objects hierarchy. |
| Page | Page | Root element of Visio objects hierarchy. |
| OneD | boolean | Determines whether the shape behaves as a one-dimensional (1-D) object. Read-only. |
| TwoD | boolean | Determines whether the shape behaves as a two-dimensional (2-D) object. |
| ControlData | byte[] | Gets the data of control. |
| ActiveXControl | ActiveXControl | Gets the ActiveX control. |
| ZOrderIndex | int | Returns the index of a shape in the z-order except the guide shape. |
| PresetTheme | int | Apply a preset theme to this shape The value of the property is PresetThemeValue integer constant. |
| PresetThemeVariant | int | Apply a preset theme variant to this shape The value of the property is PresetThemeVariantValue integer constant. |
| PresetThemeQuickStyle | int | Apply a preset theme variant quickstyle to this shape The value of the property is PresetQuickStyleValue integer constan |
| ThreeDFormat | ThreeDFormat | Gets the ThreeDFormat. |
Methods
| Name | Description |
|---|---|
| convertToGroup | Converts a selection or an object from another application (a linked or embedded object) to a group. |
| getConnectorsType | Get Connectors type |
| setConnectorJumpValue | Set Jump code value and Jump style value for Connector |
| setConnectorsType | Set Connectors type |
| getRelationFlag | Returns RelationFlag that represents the relationship of one shape to another shape. |
| getRelationShapeCollection | Returns RelationShapeCollection that represents the relationshapes of one shape. |
| setPresetThemeStyleMatrics | pply a preset theme variant quickstyle to this shape, like theme styles options in shape styles dropdown list |
| copy | |
| bringForward | Brings the shape forward one position in the z-order. |
| sendBackward | Moves the shape back one position in the z-order. |
| bringToFront | Brings the shape to the front of the z-order. |
| sendToBack | Moves the shape to the back of the z-order. |
| getConnectorRule | Returns a connectorRule that contains the shape id and connecton that are connected to the shape. |
| connectedShapes | Returns an array that contains the identifiers (IDs) of the shapes that are connected to the shape. |
| isInGroup | Indicates whether this shape is in a group shape. |
| isContain | Indicates whether this shape is contain another shape. |
| isIntersect | Indicates whether this shape is intersect another shape. |
| isConnected | Indicates whether this two shapes are connected. |
| centerDrawing | Center the shape with respect to the extent of the page |
| isGlued | Indicates whether this two shapes are glued. |
| refreshData | |
| gluedShapes | Returns an array that contains the identifiers of the shapes that are glued to a shape. |
| dependsOnShapes | Returns an array that contains the identifiers of the shapes that are depends on a shape. |
| setWidth | Sets new width of shape. |
| setHeight | Sets new height of shape. |
| setAngle | Sets new angle of shape. The angle’s unit is radian. |
| moveTo | Moves shape on new absolute position on the page. |
| move | Moves shape on the dX and dY inches from current position. |
| getDisplayText | Get the text displayed on the interface |
| getPureText | Get the text string |
| ungroup | Ungroup Shape |
| replaceText | Replace the text string of a shape . |
| toPdf | Saves the shape to a pdf file. |
Shape()
Constructor.
Shape.ID property
The unique ID of the element within its parent element.
Type: long
Shape.Del property
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.
Type: int
Shape.UniqueID property
A GUID (globally unique identifier) assigned to the shape.
Type: UUID
Shape.Name property
The name of the element.
Type: String
Shape.NameU property
The universal name of the element.
Type: String
Shape.Type property
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.
Type: int
Shape.LineStyle property
StyleSheet from which this shape inherits line formatting
Type: StyleSheet
Shape.FillStyle property
StyleSheet from which this shape inherits fill formatting.
Type: StyleSheet
Shape.TextStyle property
StyleSheet from which this shape inherits text formatting.
Type: StyleSheet
Shape.Shapes property
Contains a collection of Shape elements.
Type: ShapeCollection
Shape.Text property
Contains the text of a shape.
Type: Text
Shape.XForm property
Contains elements specifying general positioning information about a shape.
Type: XForm
Shape.Line property
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).
Type: Line
Shape.Fill property
Contains the current fill formatting values for the shape and the shape’s drop shadow, including pattern, foreground color, and background color.
Type: Fill
Shape.HasThemeColor property
Gets whether the shape has theme color.
Type: boolean
Shape.InheritChars property
Contains the char values for the shape inherit by the master shape.
Type: CharCollection
Shape.InheritProps property
Contains the props for the shape inherit by the master shape.
Type: PropCollection
Shape.InheritFields property
Contains the fields for the shape inherit by the master shape.
Type: FieldCollection
Shape.InheritActs property
Contains the actions for the shape inherit by the master shape.
Type: ActCollection
Shape.InheritHyperlinks property
Contains the Hyperlinks for the shape inherit by the master shape.
Type: HyperlinkCollection
Shape.InheritXForm property
Type: XForm
Shape.InheritXForm1D property
Type: XForm1D
Shape.InheritMisc property
Contains the Misc for the shape inherit by the master shape.
Type: Misc
Shape.InheritProtection property
Contains the Protection for the shape inherit by the master shape.
Type: Protection
Shape.InheritEvent property
Contains the Event for the shape inherit by the master shape.
Type: Event
Shape.InheritLayerMem property
Contains the LayerMem for the shape inherit by the master shape.
Type: LayerMem
Shape.InheritHelp property
Contains the Help for the shape inherit by the master shape.
Type: Help
Shape.InheritLayout property
Contains the Layout for the shape inherit by the master shape.
Type: Layout
Shape.InheritControls property
Contains the controls for the shape inherit by the master shape.
Type: ControlCollection
Shape.InheritConnections property
Contains the connections for the shape inherit by the master shape.
Type: ConnectionCollection
Shape.InheritScratchs property
Contains the scratchs for the shape inherit by the master shape.
Type: ScratchCollection
Shape.InheritGroup property
Type: Group
Shape.InheritUsers property
Contains the users for the shape inherit by the master shape.
Type: UserCollection
Shape.InheritTextXForm property
Contains the textxform values for the shape inherit by the parent style and the master shape.
Type: TextXForm
Shape.InheritGeoms property
Contains the Geoms values for the shape inherit by the master shape.
Type: GeomCollection
Shape.InheritParas property
Contains the paras for the shape inherit by the parent style and the master shape.
Type: ParaCollection
Shape.InheritTabs property
Contains the tabs for the shape inherit by the parent style and the master shape.
Type: TabsCollection
Shape.InheritTextBlock property
Contains the textblock values for the shape inherit by the parent style and the master shape.
Type: TextBlock
Shape.InheritLine property
Contains the line formatting values for the shape inherit by the parent style and the master shape.
Type: Line
Shape.InheritFill property
Contains the fill formatting values for the shape inherit by the parent style and the master shape.
Type: Fill
Shape.XForm1D property
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.
Type: XForm1D
Shape.Event property
Contains elements that specify formulas that control shape events.
Type: Event
Shape.LayerMem property
Contains the LayerMember element, which specifies each layer to which the shape is assigned.
Type: LayerMem
Shape.Foreign property
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.
Type: Foreign
Shape.TextBlock property
Contains elements that specify the alignment, margins, and default tab stop positions of text in a shape’s text block.
Type: TextBlock
Shape.TextXForm property
Contains elements that specify positioning information about a shape’s text block.
Type: TextXForm
Shape.Align property
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.
Type: Align
Shape.Protection property
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.
Type: Protection
Shape.Help property
Contains elements specifying the Shape element’s Help file topic and copyright information.
Type: Help
Shape.Misc property
Contains elements specifying the Shape element’s Help file topic and copyright information.
Type: Misc
Shape.Image property
Contains the gamma, brightness, contrast, blur, sharpen, denoise, and transparency values for a bitmap.
Type: Image
Shape.Group property
Contains elements that control how you add shapes to a group, move members of a group, and select groups.
Type: Group
Shape.Layout property
Contains elements that control shape placement and connector routing settings.
Type: Layout
Shape.Chars property
Contains a collection of Char elements.
Type: CharCollection
Shape.Paras property
Contains a collection of Para elements.
Type: ParaCollection
Shape.Scratchs property
Contains a collection of Scratch elements.
Type: ScratchCollection
Shape.Connections property
Contains a collection of Connection elements.
Type: ConnectionCollection
Shape.ContainerProperties property
Contains shape’s ContainerProperties.
Type: ContainerProperties
Shape.ConnectionABCDs property
Contains a collection of ConnectionABCD elements.
Type: ConnectionABCDCollection
Shape.Fields property
Contains a collection of Field elements.
Type: FieldCollection
Shape.Controls property
Contains a collection of Control elements.
Type: ControlCollection
Shape.Geoms property
Contains a collection of Geom elements.
Type: GeomCollection
Shape.Acts property
Contains a collection of Act elements.
Type: ActCollection
Shape.Users property
Contains a collection of User elements.
Type: UserCollection
Shape.Props property
Contains a collection of Prop elements.
Type: PropCollection
Shape.Hyperlinks property
Contains a collection of Hyperlink elements.
Type: HyperlinkCollection
Shape.SmartTagDefs property
Contains a collection of SmartTagDef elements.
Type: SmartTagDefCollection
Shape.TabsCollection property
Contains a collection of Tab elements.
Type: TabsCollection
Shape.Data1 property
Contains an arbitrary string value that is used to supply additional information about a shape.
Type: String
Shape.Data2 property
Contains an arbitrary string value that is used to supply additional information about a shape.
Type: String
Shape.Data3 property
Contains an arbitrary string value that is used to supply additional information about a shape.
Type: String
Shape.ClippingPath property
Contains Clipping Path string value.
Type: String
Shape.ForeignData property
Contains a MIME (Multipurpose Internet Mail Extensions) encoded BLOB of picture data, such as Windows metafile, bitmap, or OLE data.
Type: ForeignData
Shape.MasterShape property
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.
Type: Shape
Shape.Master property
The Master from which the shape inherits its data.
Type: Master
Shape.ParentShape property
Shape’s parent.
Type: Shape
Shape.RootShape property
Returns the top-level shape of an instance if this shape is part of a master instance. Read-only.
Type: Shape
Shape.Diagram property
Root element of Visio objects hierarchy.
Type: Diagram
Shape.Page property
Root element of Visio objects hierarchy.
Type: Page
Shape.OneD property
Determines whether the shape behaves as a one-dimensional (1-D) object. Read-only.
Type: boolean
Shape.TwoD property
Determines whether the shape behaves as a two-dimensional (2-D) object.
Type: boolean
Shape.ControlData property
Gets the data of control.
Type: byte[]
Shape.ActiveXControl property
Gets the ActiveX control.
Type: ActiveXControl
Shape.ZOrderIndex property
Returns the index of a shape in the z-order except the guide shape.
Type: int
Shape.PresetTheme property
Apply a preset theme to this shape The value of the property is PresetThemeValue integer constant.
Type: int
Shape.PresetThemeVariant property
Apply a preset theme variant to this shape The value of the property is PresetThemeVariantValue integer constant.
Type: int
Shape.PresetThemeQuickStyle property
Apply a preset theme variant quickstyle to this shape The value of the property is PresetQuickStyleValue integer constant.
Type: int
Shape.ThreeDFormat property
Gets the ThreeDFormat.
Type: ThreeDFormat
convertToGroup()
Converts a selection or an object from another application (a linked or embedded object) to a group.
getConnectorsType()
Get Connectors type
setConnectorJumpValue(code, style)
Set Jump code value and Jump style value for Connector
| Parameter | Type | Description |
|---|---|---|
| code | int | A ConLineJumpCodeValue value. Jump Code Value |
| style | int | A ConLineJumpStyleValue value. Jump Code Style |
setConnectorsType(type)
Set Connectors type
| Parameter | Type | Description |
|---|---|---|
| type | int | A ConnectorsTypeValue value. Connectors type 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(shape)
Returns RelationFlag that represents the relationship of one shape to another shape.
| Parameter | Type | Description |
|---|---|---|
| shape | Shape | Shape |
getRelationShapeCollection()
Returns RelationShapeCollection that represents the relationshapes of one shape.
setPresetThemeStyleMatrics(styleIndex, colorIndex)
pply a preset theme variant quickstyle to this shape, like theme styles options in shape styles dropdown list
| Parameter | Type | Description |
|---|---|---|
| styleIndex | int | A PresetStyleMatricsValue value. the row of style matrics |
| colorIndex | int | A PresetColorMatricsValue value. the column of style matrics |
copy(source)
| Parameter | Type | Description |
|---|---|---|
| source | Shape | Source shape |
bringForward()
Brings the shape forward one position in the z-order.
sendBackward()
Moves the shape back one position in the z-order.
bringToFront()
Brings the shape to the front of the z-order.
sendToBack()
Moves the shape to the back of the z-order.
getConnectorRule()
Returns a connectorRule that contains the shape id and connecton that are connected to the shape.
Returns: ConnectorRule.
connectedShapes(flag, categoryFilter)
Returns an array that contains the identifiers (IDs) of the shapes that are connected to the shape.
| Parameter | Type | Description |
|---|---|---|
| flag | int | A ConnectedShapesFlags value. Filters the array of returned shape IDs by the directionality of the connectors. See Remarks for possible values ConnectedShapesFlags . |
| categoryFilter | String | Filters the array of returned shape IDs by limiting it to the IDs of shapes that match the specified category java.lang.String . |
Returns: IDs array long .
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()
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(shape)
Indicates whether this shape is contain another shape.
isIntersect(shape)
Indicates whether this shape is intersect another shape.
isConnected(shape)
Indicates whether this two shapes are connected.
| Parameter | Type | Description |
|---|---|---|
| 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()
Center the shape with respect to the extent of the page
isGlued(shape)
Indicates whether this two shapes are glued.
| Parameter | Type | Description |
|---|---|---|
| shape | Shape | shape |
refreshData() (1 of 2)
refreshData(options) (2 of 2)
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(flag, categoryFilter, otherShape)
Returns an array that contains the identifiers of the shapes that are glued to a shape.
| Parameter | Type | Description |
|---|---|---|
| flag | int | A GluedShapesFlags value. The dimensionality and directionality of the connection points of the shapes to return.See Remarks for possible values GluedShapesFlags . |
| categoryFilter | String | Filters the array of returned shape IDs by limiting it to the IDs of shapes that match the specified category java.lang.String . |
| otherShape | Shape | Optional: additional shape to which returned shapes must also be glued, can be Shape or null. |
Returns: IDs array long .
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()
Returns an array that contains the identifiers of the shapes that are depends on a shape.
Returns: IDs array long .
setWidth(width)
Sets new width of shape.
| Parameter | Type | Description |
|---|---|---|
| width | float | New width double . |
setHeight(height)
Sets new height of shape.
| Parameter | Type | Description |
|---|---|---|
| height | float | New height double . |
setAngle(angle)
Sets new angle of shape. The angle’s unit is radian.
| Parameter | Type | Description |
|---|---|---|
| angle | float | New angle which unit is radian not degree double . |
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(newPinX, newPinY)
Moves shape on new absolute position on the page.
| Parameter | Type | Description |
|---|---|---|
| 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(dX, dY)
Moves shape on the dX and dY inches from current position.
| Parameter | Type | Description |
|---|---|---|
| dX | float | X offset double . |
| dY | float | Y offset double . |
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()
Get the text displayed on the interface
getPureText()
Get the text string
ungroup()
Ungroup Shape
replaceText(text, replaceText)
Replace the text string of a shape .
toPdf(fileName)
Saves the shape to a pdf file.
| Parameter | Type | Description |
|---|---|---|
| fileName | String | the pdf file name with full path |