API Reference

Class

VisioShape

Namespace OfficeIMO.Visio
Assembly OfficeIMO.Visio

Represents a shape on a Visio page.

Inheritance

  • Object
  • VisioShape

Usage

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by

Accepted by parameters

Constructors

VisioShape 2 overloads
public VisioShape(String id) #

Initializes a new instance of the VisioShape class with the specified identifier.

Parameters

id System.String requiredposition: 0
Identifier of the shape.
public VisioShape(String id, Double pinX, Double pinY, Double width, Double height, String text) #

Initializes a new instance of the VisioShape class.

Parameters

id System.String requiredposition: 0
Identifier of the shape.
pinX System.Double requiredposition: 1
X coordinate of the pin.
pinY System.Double requiredposition: 2
Y coordinate of the pin.
width System.Double requiredposition: 3
Width of the shape.
height System.Double requiredposition: 4
Height of the shape.
text System.String requiredposition: 5
Text contained within the shape.

Methods

AddHyperlink 2 overloads
public VisioShape ClearLayoutPolicy() #
Returns: VisioShape

Clears explicit Shape Layout override cells from this shape.

public VisioShape ClearProtection() #
Returns: VisioShape

Clears explicit ShapeSheet protection cells from this shape.

EnsureSideConnectionPoints() #

Ensures the shape has four side connection points (Left, Right, Bottom, Top). If they already exist (>=4), nothing is added. Internal: users should not call this; side points are added automatically by the connector API when explicit sides are requested.

public VisioShape FindDescendantById(String id) #
Returns: VisioShape

Recursively searches the shape hierarchy for a shape with the provided identifier.

Parameters

id System.String requiredposition: 0
Identifier to locate.

Returns

The matching shape when found; otherwise null.

public VisioShapeDataRow FindShapeData(String name) #
Returns: VisioShapeDataRow

Finds a Shape Data row by row name.

Parameters

name System.String requiredposition: 0
Shape Data row name.
public VisioUserCell FindUserCell(String name) #
Returns: VisioUserCell

Finds a user-defined ShapeSheet cell by row name.

Parameters

name System.String requiredposition: 0
User cell row name.
public ValueTuple<Double, Double> GetAbsolutePoint(Double x, Double y) #
Returns: ValueTuple<Double, Double>

Transforms a point from the shape's local coordinate system to the page coordinate system.

Parameters

x System.Double requiredposition: 0
X coordinate of the point relative to the shape's local coordinate system.
y System.Double requiredposition: 1
Y coordinate of the point relative to the shape's local coordinate system.

Returns

The point's absolute coordinates on the page.

public ValueTuple<Double, Double, Double, Double> GetBounds() #
Returns: ValueTuple<Double, Double, Double, Double>

Computes the absolute bounds of the shape on the page.

public String GetShapeDataValue(String name) #
Returns: String

Gets a Shape Data value by row name.

Parameters

name System.String requiredposition: 0
Shape Data row name.
public String GetUserCellValue(String name) #
Returns: String

Gets a user-defined ShapeSheet cell value by row name.

Parameters

name System.String requiredposition: 0
User cell row name.
public VisioShape LockPosition(Boolean locked = true) #
Returns: VisioShape

Locks or unlocks this shape's position.

Parameters

locked System.Boolean = true optionalposition: 0
public VisioShape LockSize(Boolean locked = true) #
Returns: VisioShape

Locks or unlocks this shape's size.

Parameters

locked System.Boolean = true optionalposition: 0
public VisioShape Protect(Action<VisioShapeProtection> configure) #
Returns: VisioShape

Configures ShapeSheet protection cells for this shape.

Parameters

configure System.Action{OfficeIMO.Visio.VisioShapeProtection} requiredposition: 0
Protection configuration delegate.
public VisioShapeDataRow SetShapeData(String name, String value, String label = null, Nullable<VisioShapeDataType> type = null, String prompt = null, String format = null) #
Returns: VisioShapeDataRow

Sets or creates a Shape Data row.

Parameters

name System.String requiredposition: 0
Shape Data row name.
value System.String requiredposition: 1
Shape Data value.
label System.String = null optionalposition: 2
Optional label shown in Visio's Shape Data window.
type System.Nullable{OfficeIMO.Visio.VisioShapeDataType} = null optionalposition: 3
Optional Shape Data type.
prompt System.String = null optionalposition: 4
Optional help prompt.
format System.String = null optionalposition: 5
Optional format picture or list values.
public VisioUserCell SetUserCell(String name, String value, String unit = null, String formula = null, String prompt = null) #
Returns: VisioUserCell

Sets or creates a user-defined ShapeSheet cell.

Parameters

name System.String requiredposition: 0
User cell row name.
value System.String requiredposition: 1
Value cell contents.
unit System.String = null optionalposition: 2
Optional unit.
formula System.String = null optionalposition: 3
Optional ShapeSheet formula.
prompt System.String = null optionalposition: 4
Optional prompt.

Properties

public String Id { get; } #

Identifier of the shape.

PersistedId #

Identifier stored in the package when different from Id.

public String Name { get; set; } #

Gets or sets the shape name.

public String NameU { get; set; } #

Gets or sets the universal name of the shape.

public String Type { get; set; } #

Gets or sets the Visio type of the shape (for example "Group").

public VisioMaster Master { get; set; } #

Gets or sets the master associated with the shape.

public String MasterShapeId { get; set; } #

Gets the identifier of the referenced master shape when Master is defined.

public VisioShape MasterShape { get; set; } #

Gets the master shape instance referenced by MasterShapeId, if any.

public String MasterNameU { get; } #

Gets the universal name of the master.

public Double PinX { get; set; } #

Gets or sets the X coordinate of the pin.

public Double PinY { get; set; } #

Gets or sets the Y coordinate of the pin.

public Double Width { get; set; } #

Gets or sets the width of the shape.

public Double Height { get; set; } #

Gets or sets the height of the shape.

public Double LineWeight { get; set; } #

Gets or sets the line weight of the shape.

public Double LocPinX { get; set; } #

Gets or sets the X coordinate of the local pin.

public Double LocPinY { get; set; } #

Gets or sets the Y coordinate of the local pin.

public Double Angle { get; set; } #

Gets or sets the rotation angle of the shape in radians.

public String Text { get; set; } #

Gets or sets the text contained in the shape.

public VisioTextStyle TextStyle { get; set; } #

Gets or sets whole-shape text formatting.

public OfficeColor LineColor { get; set; } #

Line (border) color of the shape.

public OfficeColor FillColor { get; set; } #

Fill color of the shape.

public Int32 LinePattern { get; set; } #

Line pattern (0=None, 1=Solid, 2=Dashed, etc.).

public Int32 FillPattern { get; set; } #

Fill pattern (0=None, 1=Solid, etc.).

public VisioShape Parent { get; set; } #

Parent shape when part of a group hierarchy.

public IList<VisioShape> Children { get; } #

Child shapes when this shape represents a group.

public IList<VisioConnectionPoint> ConnectionPoints { get; } #

Connection points associated with the shape.

public ISet<String> LayerNames { get; } #

Page layer names this shape belongs to.

public IList<VisioUserCell> UserCells { get; } #

User-defined ShapeSheet cells attached to this shape.

public IList<VisioShapeDataRow> ShapeData { get; } #

Visio Shape Data rows attached to this shape.

public VisioShapeProtection Protection { get; } #

Visio ShapeSheet protection cells controlling interactive editing in Visio.

public Nullable<VisioPlacementStyle> PlacementStyle { get; set; } #

Gets or sets the shape-level placement style Visio uses during page layout.

public Nullable<VisioPlacementFlip> PlacementFlip { get; set; } #

Gets or sets how Visio may flip or rotate this shape during page layout.

public Nullable<VisioShapePlowCode> PlowCode { get; set; } #

Gets or sets whether this shape moves away when another placeable shape is dropped nearby.

public Nullable<Boolean> AllowPlacementOnTop { get; set; } #

Gets or sets whether other placeable shapes may be placed on top of this shape during layout.

public Nullable<Boolean> AllowHorizontalConnectorRoutingThrough { get; set; } #

Gets or sets whether connectors may route horizontally through this shape.

public Nullable<Boolean> AllowVerticalConnectorRoutingThrough { get; set; } #

Gets or sets whether connectors may route vertically through this shape.

public Nullable<Boolean> CanSplitShapes { get; set; } #

Gets or sets whether this shape may split other splittable shapes.

public Nullable<Boolean> CanBeSplit { get; set; } #

Gets or sets whether this shape can be split by another shape.

public IList<String> ContainerMemberIds { get; } #

Shape identifiers this shape contains when it is used as a container.

public IList<String> ContainerOwnerIds { get; } #

Container shape identifiers this shape belongs to.

public Boolean IsContainer { get; } #

Gets whether this shape is marked as a Visio container.

public Boolean IsCallout { get; } #

Gets whether this shape is marked as an OfficeIMO callout or annotation.

public Boolean IsBackgroundSurface { get; } #

Gets whether this shape is marked as a background surface such as a region, zone, lane, or band.

public Boolean IsDiagramAdornment { get; } #

Gets whether this shape is marked as a generated diagram adornment such as a title, legend item, or zone caption.

public String CalloutTargetId { get; } #

Gets the target shape identifier for an OfficeIMO callout, if available.

PreservedGeometrySections #

Geometry sections captured from a loaded package so custom shape outlines can be preserved on save.

public Dictionary<String, String> Data { get; } #

Arbitrary data associated with the shape.

Fields

DefaultLineWeight #

Default line weight used when Visio does not specify a value.

Extension Methods

public static VisioShape ApplyStyle(VisioShape shape, VisioShapeStyle style) #
Returns: VisioShape

Applies a reusable style to a shape.

Parameters

shape OfficeIMO.Visio.VisioShape requiredposition: 0
style OfficeIMO.Visio.VisioShapeStyle requiredposition: 1
public static VisioShape ApplyTextStyle(VisioShape shape, VisioTextStyle style) #
Returns: VisioShape

Applies a reusable text style to a shape.

Parameters

shape OfficeIMO.Visio.VisioShape requiredposition: 0
style OfficeIMO.Visio.VisioTextStyle requiredposition: 1
public static VisioShapeBounds GetShapeBounds(VisioShape shape) #
Returns: VisioShapeBounds

Gets the page-space bounds for a shape.

Parameters

shape OfficeIMO.Visio.VisioShape requiredposition: 0
Shape to inspect.
public static VisioShape MarkAsBackgroundSurface(VisioShape shape) #
Returns: VisioShape

Marks a shape as a background surface such as a zone, subnet, lane, band, or grouping region.

Parameters

shape OfficeIMO.Visio.VisioShape requiredposition: 0
Shape to mark.
public static VisioShape MarkAsGeneratedDiagramAdornment(VisioShape shape) #
Returns: VisioShape

Marks a generated label, title, legend item, or caption as a diagram adornment that quality checks and routing can treat as non-domain content.

Parameters

shape OfficeIMO.Visio.VisioShape requiredposition: 0
Shape to mark.
public static VisioShape ResizeToText(VisioShape shape, Nullable<OfficeFontInfo> fontInfo = null, Double horizontalPadding = 0.25, Double verticalPadding = 0.14, Double minimumWidth = 0.5, Double minimumHeight = 0.3) #
Returns: VisioShape

Resizes a shape to fit its plain text using deterministic OfficeIMO.Drawing measurement.

Parameters

shape OfficeIMO.Visio.VisioShape requiredposition: 0
Shape to resize.
fontInfo System.Nullable{OfficeIMO.Drawing.OfficeFontInfo} = null optionalposition: 1
Font descriptor used for measurement. Uses Office default when omitted.
horizontalPadding System.Double = 0.25 optionalposition: 2
Horizontal padding in inches.
verticalPadding System.Double = 0.14 optionalposition: 3
Vertical padding in inches.
minimumWidth System.Double = 0.5 optionalposition: 4
Minimum resulting width in inches.
minimumHeight System.Double = 0.3 optionalposition: 5
Minimum resulting height in inches.