Shape

Shape class

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

Shape()

Constructor.

Properties

NameTypeDescription
IDlongThe unique ID of the element within its parent element.
DelintA flag indicating whether the element is deleted locally. A value of 1 indicates that the element is deleted locally. Th
UniqueIDUUIDA GUID (globally unique identifier) assigned to the shape.
NameStringThe name of the element.
NameUStringThe universal name of the element.
TypeintThe type of a shape. It may be one of the following values: Group, Shape, Guide, or Foreign. The value of the property i
LineStyleStyleSheetStyleSheet from which this shape inherits line formatting
FillStyleStyleSheetStyleSheet from which this shape inherits fill formatting.
TextStyleStyleSheetStyleSheet from which this shape inherits text formatting.
ShapesShapeCollectionContains a collection of Shape elements.
TextTextContains the text of a shape.
XFormXFormContains elements specifying general positioning information about a shape.
LineLineContains elements that control line attributes for a shape, such as pattern, weight, and color. These elements determine
FillFillContains the current fill formatting values for the shape and the shape’s drop shadow, including pattern, foreground col
HasThemeColorbooleanGets whether the shape has theme color.
InheritCharsCharCollectionContains the char values for the shape inherit by the master shape.
InheritPropsPropCollectionContains the props for the shape inherit by the master shape.
InheritFieldsFieldCollectionContains the fields for the shape inherit by the master shape.
InheritActsActCollectionContains the actions for the shape inherit by the master shape.
InheritHyperlinksHyperlinkCollectionContains the Hyperlinks for the shape inherit by the master shape.
InheritXFormXForm
InheritXForm1DXForm1D
InheritMiscMiscContains the Misc for the shape inherit by the master shape.
InheritProtectionProtectionContains the Protection for the shape inherit by the master shape.
InheritEventEventContains the Event for the shape inherit by the master shape.
InheritLayerMemLayerMemContains the LayerMem for the shape inherit by the master shape.
InheritHelpHelpContains the Help for the shape inherit by the master shape.
InheritLayoutLayoutContains the Layout for the shape inherit by the master shape.
InheritControlsControlCollectionContains the controls for the shape inherit by the master shape.
InheritConnectionsConnectionCollectionContains the connections for the shape inherit by the master shape.
InheritScratchsScratchCollectionContains the scratchs for the shape inherit by the master shape.
InheritGroupGroup
InheritUsersUserCollectionContains the users for the shape inherit by the master shape.
InheritTextXFormTextXFormContains the textxform values for the shape inherit by the parent style and the master shape.
InheritGeomsGeomCollectionContains the Geoms values for the shape inherit by the master shape.
InheritParasParaCollectionContains the paras for the shape inherit by the parent style and the master shape.
InheritTabsTabsCollectionContains the tabs for the shape inherit by the parent style and the master shape.
InheritTextBlockTextBlockContains the textblock values for the shape inherit by the parent style and the master shape.
InheritLineLineContains the line formatting values for the shape inherit by the parent style and the master shape.
InheritFillFillContains the fill formatting values for the shape inherit by the parent style and the master shape.
XForm1DXForm1DContains x- and y-coordinates of the begin point and end point of a 1-D shape. This element appears for 1-D shapes only.
EventEventContains elements that specify formulas that control shape events.
LayerMemLayerMemContains the LayerMember element, which specifies each layer to which the shape is assigned.
ForeignForeignContains elements specifying the width and height of an object from another program used in a Microsoft Visio document.
TextBlockTextBlockContains elements that specify the alignment, margins, and default tab stop positions of text in a shape’s text block.
TextXFormTextXFormContains elements that specify positioning information about a shape’s text block.
AlignAlignIndicates the alignment of a shape with respect to the guide or guide point to which the shape is glued. The Align eleme
ProtectionProtectionLocking helps prevent inadvertent changes to the shape but does not prevent Microsoft Visio from resetting values in oth
HelpHelpContains elements specifying the Shape element’s Help file topic and copyright information.
MiscMiscContains elements specifying the Shape element’s Help file topic and copyright information.
ImageImageContains the gamma, brightness, contrast, blur, sharpen, denoise, and transparency values for a bitmap.
GroupGroupContains elements that control how you add shapes to a group, move members of a group, and select groups.
LayoutLayoutContains elements that control shape placement and connector routing settings.
CharsCharCollectionContains a collection of Char elements.
ParasParaCollectionContains a collection of Para elements.
ScratchsScratchCollectionContains a collection of Scratch elements.
ConnectionsConnectionCollectionContains a collection of Connection elements.
ContainerPropertiesContainerPropertiesContains shape’s ContainerProperties.
ConnectionABCDsConnectionABCDCollectionContains a collection of ConnectionABCD elements.
FieldsFieldCollectionContains a collection of Field elements.
ControlsControlCollectionContains a collection of Control elements.
GeomsGeomCollectionContains a collection of Geom elements.
ActsActCollectionContains a collection of Act elements.
UsersUserCollectionContains a collection of User elements.
PropsPropCollectionContains a collection of Prop elements.
HyperlinksHyperlinkCollectionContains a collection of Hyperlink elements.
SmartTagDefsSmartTagDefCollectionContains a collection of SmartTagDef elements.
TabsCollectionTabsCollectionContains a collection of Tab elements.
Data1StringContains an arbitrary string value that is used to supply additional information about a shape.
Data2StringContains an arbitrary string value that is used to supply additional information about a shape.
Data3StringContains an arbitrary string value that is used to supply additional information about a shape.
ClippingPathStringContains Clipping Path string value.
ForeignDataForeignDataContains a MIME (Multipurpose Internet Mail Extensions) encoded BLOB of picture data, such as Windows metafile, bitmap,
MasterShapeShapeThis attribute may only be present in shapes that are members of a group shape, and the group is an instance of a master
MasterMasterThe Master from which the shape inherits its data.
ParentShapeShapeShape’s parent.
RootShapeShapeReturns the top-level shape of an instance if this shape is part of a master instance. Read-only.
DiagramDiagramRoot element of Visio objects hierarchy.
PagePageRoot element of Visio objects hierarchy.
OneDbooleanDetermines whether the shape behaves as a one-dimensional (1-D) object. Read-only.
TwoDbooleanDetermines whether the shape behaves as a two-dimensional (2-D) object.
ControlDatabyte[]Gets the data of control.
ActiveXControlActiveXControlGets the ActiveX control.
ZOrderIndexintReturns the index of a shape in the z-order except the guide shape.
PresetThemeintApply a preset theme to this shape The value of the property is PresetThemeValue integer constant.
PresetThemeVariantintApply a preset theme variant to this shape The value of the property is PresetThemeVariantValue integer constant.
PresetThemeQuickStyleintApply a preset theme variant quickstyle to this shape The value of the property is PresetQuickStyleValue integer constan
ThreeDFormatThreeDFormatGets the ThreeDFormat.

Methods

NameDescription
convertToGroupConverts a selection or an object from another application (a linked or embedded object) to a group.
getConnectorsTypeGet Connectors type
setConnectorJumpValueSet Jump code value and Jump style value for Connector
setConnectorsTypeSet Connectors type
getRelationFlagReturns RelationFlag that represents the relationship of one shape to another shape.
getRelationShapeCollectionReturns RelationShapeCollection that represents the relationshapes of one shape.
setPresetThemeStyleMatricspply a preset theme variant quickstyle to this shape, like theme styles options in shape styles dropdown list
copy
bringForwardBrings the shape forward one position in the z-order.
sendBackwardMoves the shape back one position in the z-order.
bringToFrontBrings the shape to the front of the z-order.
sendToBackMoves the shape to the back of the z-order.
getConnectorRuleReturns a connectorRule that contains the shape id and connecton that are connected to the shape.
connectedShapesReturns an array that contains the identifiers (IDs) of the shapes that are connected to the shape.
isInGroupIndicates whether this shape is in a group shape.
isContainIndicates whether this shape is contain another shape.
isIntersectIndicates whether this shape is intersect another shape.
isConnectedIndicates whether this two shapes are connected.
centerDrawingCenter the shape with respect to the extent of the page
isGluedIndicates whether this two shapes are glued.
refreshData
gluedShapesReturns an array that contains the identifiers of the shapes that are glued to a shape.
dependsOnShapesReturns an array that contains the identifiers of the shapes that are depends on a shape.
setWidthSets new width of shape.
setHeightSets new height of shape.
setAngleSets new angle of shape. The angle’s unit is radian.
moveToMoves shape on new absolute position on the page.
moveMoves shape on the dX and dY inches from current position.
getDisplayTextGet the text displayed on the interface
getPureTextGet the text string
ungroupUngroup Shape
replaceTextReplace the text string of a shape .
toPdfSaves the shape to a pdf file.