API Reference

Class

VisioShapeSelection

Namespace OfficeIMO.Visio
Assembly OfficeIMO.Visio
Implements
IReadOnlyList<VisioShape> IReadOnlyCollection<VisioShape> IEnumerable<VisioShape> IEnumerable
Modifiers sealed
Attributes
DefaultMember("Item")

Editable set of Visio shapes returned by query helpers.

Inheritance

  • Object
  • VisioShapeSelection

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

public VisioShapeSelection(IEnumerable<VisioShape> shapes, VisioPage ownerPage = null) #

Initializes a new shape selection.

Parameters

shapes System.Collections.Generic.IEnumerable{OfficeIMO.Visio.VisioShape} requiredposition: 0
Shapes included in the selection.
ownerPage OfficeIMO.Visio.VisioPage = null optionalposition: 1
Optional page that owns the selection.

Methods

public VisioShapeSelection ClearProtection() #
Returns: VisioShapeSelection

Clears explicit protection settings for every selected shape.

public VisioShapeSelection Data(String key, String value) #
Returns: VisioShapeSelection

Sets or replaces a data value on every selected shape.

Parameters

key System.String requiredposition: 0
Data key.
value System.String requiredposition: 1
Data value.
public VisioShapeSelection Fill(OfficeColor color, Int32 pattern = 1) #
Returns: VisioShapeSelection

Sets fill color and optional fill pattern on every selected shape.

Parameters

color OfficeIMO.Drawing.OfficeColor requiredposition: 0
Fill color.
pattern System.Int32 = 1 optionalposition: 1
Fill pattern index.
public virtual IEnumerator<VisioShape> GetEnumerator() #
Returns: IEnumerator<VisioShape>
public VisioShapeSelection Layer(String layerName) #
Returns: VisioShapeSelection

Adds every selected shape to a page layer.

Parameters

layerName System.String requiredposition: 0
Layer name.
public VisioShapeSelection LineColor(OfficeColor color) #
Returns: VisioShapeSelection

Sets line color on every selected shape.

Parameters

color OfficeIMO.Drawing.OfficeColor requiredposition: 0
Line color.
public VisioShapeSelection LinePattern(Int32 pattern) #
Returns: VisioShapeSelection

Sets line pattern on every selected shape.

Parameters

pattern System.Int32 requiredposition: 0
Line pattern index.
public VisioShapeSelection LineWeight(Double weight) #
Returns: VisioShapeSelection

Sets line weight on every selected shape.

Parameters

weight System.Double requiredposition: 0
Line weight in inches.
public VisioShapeSelection LockPosition(Boolean locked = true) #
Returns: VisioShapeSelection

Locks or unlocks position for every selected shape.

Parameters

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

Locks or unlocks size for every selected shape.

Parameters

locked System.Boolean = true optionalposition: 0
public VisioShapeSelection MoveBy(Double deltaX, Double deltaY) #
Returns: VisioShapeSelection

Moves every selected shape by the provided offset.

Parameters

deltaX System.Double requiredposition: 0
Horizontal offset in inches.
deltaY System.Double requiredposition: 1
Vertical offset in inches.
public VisioShapeSelection Protect(Action<VisioShapeProtection> configure) #
Returns: VisioShapeSelection

Configures protection for every selected shape.

Parameters

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

Sets or replaces a Visio Shape Data row on every selected shape.

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 VisioShapeSelection Size(Double width, Double height) #
Returns: VisioShapeSelection

Resizes every selected shape.

Parameters

width System.Double requiredposition: 0
New width in inches.
height System.Double requiredposition: 1
New height in inches.
public VisioShapeSelection Stroke(OfficeColor color, Double weight = 0.0138889, Int32 pattern = 1) #
Returns: VisioShapeSelection

Sets stroke color, weight, and pattern on every selected shape.

Parameters

color OfficeIMO.Drawing.OfficeColor requiredposition: 0
Line color.
weight System.Double = 0.0138889 optionalposition: 1
Line weight in inches.
pattern System.Int32 = 1 optionalposition: 2
Line pattern index.
public VisioShapeSelection Style(VisioShapeStyle style) #
Returns: VisioShapeSelection

Applies a reusable shape style on every selected shape.

Parameters

style OfficeIMO.Visio.VisioShapeStyle requiredposition: 0
Shape style to apply.
System#Collections#IEnumerable#GetEnumerator() #
Text 2 overloads
public VisioShapeSelection Text(Func<VisioShape, String> textFactory) #
Returns: VisioShapeSelection

Sets text on every selected shape.

Parameters

text System.String requiredposition: 0
Text to assign.
Text(System.Func{OfficeIMO.Visio.VisioShape,System.String} textFactory) #

Updates text on every selected shape from the current shape.

Parameters

textFactory System.Func{OfficeIMO.Visio.VisioShape,System.String} required
Factory returning text for each shape.
public VisioShapeSelection UserCell(String name, String value, String unit = null, String formula = null, String prompt = null) #
Returns: VisioShapeSelection

Sets or replaces a Visio User cell on every selected shape.

Parameters

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

Properties

public VisioPage OwnerPage { get; } #

Gets the page that produced this selection, when known.

public virtual Int32 Count { get; } #
public virtual VisioShape Item { get; } #

Extension Methods

Align 2 overloads
public static VisioShapeSelection Align(VisioShapeSelection selection, VisioHorizontalAlignment alignment) #
Returns: VisioShapeSelection

Aligns selected shapes horizontally inside the current selection bounds.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to align.
alignment OfficeIMO.Visio.VisioHorizontalAlignment requiredposition: 1
Horizontal alignment.
public static VisioShapeSelection Align(VisioShapeSelection selection, VisioVerticalAlignment alignment) #
Returns: VisioShapeSelection

Aligns selected shapes horizontally inside the current selection bounds.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to align.
alignment OfficeIMO.Visio.VisioHorizontalAlignment requiredposition: 1
Horizontal alignment.
public static VisioShapeSelection ApplyStyle(VisioShapeSelection selection, VisioShapeStyle style) #
Returns: VisioShapeSelection

Applies a reusable style to a shape.

Parameters

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

Applies a reusable text style to a shape.

Parameters

shape OfficeIMO.Visio.VisioShape requiredposition: 0
style OfficeIMO.Visio.VisioTextStyle requiredposition: 1
public static VisioShapeSelection Distribute(VisioShapeSelection selection, VisioDistributionAxis axis) #
Returns: VisioShapeSelection

Distributes selected shapes by center point along the requested axis.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to distribute.
axis OfficeIMO.Visio.VisioDistributionAxis requiredposition: 1
Distribution axis.
public static VisioShapeSelection DistributeHorizontally(VisioShapeSelection selection) #
Returns: VisioShapeSelection

Distributes selected shapes horizontally by center point.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to distribute.
public static VisioShapeSelection DistributeVertically(VisioShapeSelection selection) #
Returns: VisioShapeSelection

Distributes selected shapes vertically by center point.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to distribute.
public static VisioShapeSelection Duplicate(VisioShapeSelection selection, Double offsetX = 0.35, Double offsetY = -0.35, Boolean includeInternalConnectors = true) #
Returns: VisioShapeSelection

Duplicates a page-backed selection on the same page.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to duplicate.
offsetX System.Double = 0.35 optionalposition: 1
Horizontal offset for duplicated top-level shapes and page-coordinate routing points.
offsetY System.Double = -0.35 optionalposition: 2
Vertical offset for duplicated top-level shapes and page-coordinate routing points.
includeInternalConnectors System.Boolean = true optionalposition: 3
Whether connectors between duplicated shapes should also be copied.

Returns

A selection containing the duplicated root shapes.

public static VisioShapeBounds GetShapeBounds(VisioShapeSelection selection) #
Returns: VisioShapeBounds

Gets the page-space bounds for a shape.

Parameters

shape OfficeIMO.Visio.VisioShape requiredposition: 0
Shape to inspect.
RelayoutAsGrid 2 overloads
public static VisioShapeSelection RelayoutAsGrid(VisioShapeSelection selection, Int32 columns = 0, Double horizontalSpacing = 0.5, Double verticalSpacing = 0.5, Boolean routeInternalConnectors = true) #
Returns: VisioShapeSelection

Relays out selected shapes into a deterministic grid and optionally reroutes internal connectors.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to relayout.
columns System.Int32 = 0 optionalposition: 1
Number of columns. When zero, OfficeIMO uses a near-square grid.
horizontalSpacing System.Double = 0.5 optionalposition: 2
Horizontal spacing between columns in inches.
verticalSpacing System.Double = 0.5 optionalposition: 3
Vertical spacing between rows in inches.
routeInternalConnectors System.Boolean = true optionalposition: 4
Whether connectors whose endpoints are both selected should be rerouted orthogonally.
public static VisioShapeSelection RelayoutAsGrid(VisioShapeSelection selection, VisioSelectionLayoutOptions options) #
Returns: VisioShapeSelection

Relays out selected shapes into a deterministic grid and optionally reroutes internal connectors.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to relayout.
options OfficeIMO.Visio.VisioSelectionLayoutOptions requiredposition: 1
Layout options.
public static VisioShapeSelection RelayoutAsHorizontalStack(VisioShapeSelection selection, Double spacing = 0.5, Boolean routeInternalConnectors = true) #
Returns: VisioShapeSelection

Relays out selected shapes as a horizontal row and optionally reroutes internal connectors.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to relayout.
spacing System.Double = 0.5 optionalposition: 1
Horizontal spacing between shapes in inches.
routeInternalConnectors System.Boolean = true optionalposition: 2
Whether connectors whose endpoints are both selected should be rerouted orthogonally.
public static VisioShapeSelection RelayoutAsVerticalStack(VisioShapeSelection selection, Double spacing = 0.5, Boolean routeInternalConnectors = true) #
Returns: VisioShapeSelection

Relays out selected shapes as a vertical stack and optionally reroutes internal connectors.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to relayout.
spacing System.Double = 0.5 optionalposition: 1
Vertical spacing between shapes in inches.
routeInternalConnectors System.Boolean = true optionalposition: 2
Whether connectors whose endpoints are both selected should be rerouted orthogonally.
ReplaceMaster 3 overloads
public static VisioShapeSelection ReplaceMaster(VisioShapeSelection selection, String masterNameU, Boolean resizeToMaster = false) #
Returns: VisioShapeSelection

Replaces the master for every shape in a page-backed selection.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to update.
masterNameU System.String requiredposition: 1
Replacement master universal name.
resizeToMaster System.Boolean = false optionalposition: 2
Whether to resize each shape to the replacement master's default size.

Returns

The updated selection.

public static VisioShapeSelection ReplaceMaster(VisioShapeSelection selection, VisioMaster master, Boolean resizeToMaster = false) #
Returns: VisioShapeSelection

Replaces the master for every shape in a page-backed selection.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to update.
masterNameU System.String requiredposition: 1
Replacement master universal name.
resizeToMaster System.Boolean = false optionalposition: 2
Whether to resize each shape to the replacement master's default size.

Returns

The updated selection.

public static VisioShapeSelection ReplaceMaster(VisioShapeSelection selection, VisioStencilShape stencil, Boolean resizeToMaster = false) #
Returns: VisioShapeSelection

Replaces the master for every shape in a page-backed selection.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection requiredposition: 0
Selection to update.
masterNameU System.String requiredposition: 1
Replacement master universal name.
resizeToMaster System.Boolean = false optionalposition: 2
Whether to resize each shape to the replacement master's default size.

Returns

The updated selection.

public static VisioShapeSelection ResizeToText(VisioShapeSelection selection, Nullable<OfficeFontInfo> fontInfo = null, Double horizontalPadding = 0.25, Double verticalPadding = 0.14, Double minimumWidth = 0.5, Double minimumHeight = 0.3) #
Returns: VisioShapeSelection

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.