Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

VisioShapeSelection

OfficeIMO.Visio

Namespace
OfficeIMO.Visio
Assembly
OfficeIMO.Visio
Source revision
273d35d5ba8a with working tree changes
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

Explore 143 API references to this type

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

Returned or exposed by 84

Accepted by parameters 59

Constructors

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

Initializes a new shape selection.

Parameters

shapes System.Collections.Generic.IEnumerable<OfficeIMO.Visio.VisioShape> required
Shapes included in the selection.
ownerPage OfficeIMO.Visio.VisioPage? = null optional
Optional page that owns the selection.

Methods

public VisioShapeSelection ClearProtection() #

Clears explicit protection settings for every selected shape.

public VisioShapeSelection Data(string key, string value) #

Sets or replaces a data value on every selected shape.

Parameters

key string required
Data key.
value string required
Data value.
public VisioShapeSelection Fill(OfficeColor color, int pattern = 1) #

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

Parameters

color OfficeIMO.OfficeColor required
Fill color.
pattern int = 1 optional
Fill pattern index.
public IEnumerator<VisioShape> GetEnumerator() #

Returns an enumerator that iterates through the collection.

Returns

IEnumerator<VisioShape> An enumerator that can be used to iterate through the collection.
public VisioShapeSelection Layer(string layerName) #

Adds every selected shape to a page layer.

Parameters

layerName string required
Layer name.
public VisioShapeSelection LineColor(OfficeColor color) #

Sets line color on every selected shape.

Parameters

color OfficeIMO.OfficeColor required
Line color.
public VisioShapeSelection LinePattern(int pattern) #

Sets line pattern on every selected shape.

Parameters

pattern int required
Line pattern index.
public VisioShapeSelection LineWeight(double weight) #

Sets line weight on every selected shape.

Parameters

weight double required
Line weight in inches.
public VisioShapeSelection LockPosition(bool locked = true) #

Locks or unlocks position for every selected shape.

Parameters

locked bool = true optional
public VisioShapeSelection LockSize(bool locked = true) #

Locks or unlocks size for every selected shape.

Parameters

locked bool = true optional
public VisioShapeSelection MoveBy(double deltaX, double deltaY) #

Moves every selected shape by the provided offset.

Parameters

deltaX double required
Horizontal offset in inches.
deltaY double required
Vertical offset in inches.
public VisioShapeSelection Protect(Action<VisioShapeProtection> configure) #

Configures protection for every selected shape.

Parameters

configure System.Action<OfficeIMO.Visio.VisioShapeProtection> required
Protection configuration delegate.
ShapeData 2 overloads
public VisioShapeSelection ShapeData(string name, string? value, string? label = null, VisioShapeDataType? type = null, string? prompt = null, string? format = null) #

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

Parameters

name string required
Shape Data row name.
value string? required
Shape Data value.
label string? = null optional
Optional label shown in Visio's Shape Data window.
type OfficeIMO.Visio.VisioShapeDataType? = null optional
Optional Shape Data type.
prompt string? = null optional
Optional help prompt.
format string? = null optional
Optional format picture or list values.
public VisioShapeSelection ShapeData(VisioShapeDataSchema schema, bool overwriteValues = false) #

Applies a reusable Shape Data schema on every selected shape.

Parameters

schema OfficeIMO.Visio.VisioShapeDataSchema required
Shape Data schema to apply.
overwriteValues bool = false optional
Whether schema defaults should replace existing values.
public VisioShapeSelection Size(OfficeLength width, OfficeLength height) #

Resizes every selected shape.

Parameters

width OfficeIMO.OfficeLength required
New physical width.
height OfficeIMO.OfficeLength required
New physical height.
public VisioShapeSelection Stroke(OfficeColor color, double weight = 0.0138889, int pattern = 1) #

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

Parameters

color OfficeIMO.OfficeColor required
Line color.
weight double = 0.0138889 optional
Line weight in inches.
pattern int = 1 optional
Line pattern index.
public VisioShapeSelection Style(VisioShapeStyle style) #

Applies a reusable shape style on every selected shape.

Parameters

style OfficeIMO.Visio.VisioShapeStyle required
Shape style to apply.
Text 2 overloads
public VisioShapeSelection Text(string? text) #

Sets text on every selected shape.

Parameters

text string? required
Text to assign.
public VisioShapeSelection Text(Func<VisioShape, string?> textFactory) #

Updates text on every selected shape from the current shape.

Parameters

textFactory System.Func<OfficeIMO.Visio.VisioShape, string?> required
Factory returning text for each shape.
public VisioShapeSelection UserCell(string name, string? value, string? unit = null, string? formula = null, string? prompt = null) #

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

Parameters

name string required
User cell row name.
value string? required
User cell value.
unit string? = null optional
Optional Visio unit code.
formula string? = null optional
Optional ShapeSheet formula.
prompt string? = null optional
Optional prompt value.

Properties

public VisioPage? OwnerPage { get; } #

Gets the page that produced this selection, when known.

public int Count { get; } #

Gets the number of elements in the collection.

public VisioShape this[int index] { get; } #

Gets the element at the specified index in the read-only list.

Parameters

index int required
The zero-based index of the element to get.

Extension Methods

public static IReadOnlyList<VisioShape> AddDataGraphics(VisioShapeSelection selection, VisioDataGraphic dataGraphic) #

Adds visible data graphics for every selected shape.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Target shape selection.
dataGraphic OfficeIMO.Visio.VisioDataGraphic required
Data graphic definition.

Returns

IReadOnlyList<VisioShape>
public static VisioShapeSelection AddToContainer(VisioShapeSelection selection, VisioShape container, bool resizeToFit = true, VisioContainerOptions? resizeOptions = null) #

Adds all selected shapes to an existing Visio-native container.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
container OfficeIMO.Visio.VisioShape required
resizeToFit bool = true optional
resizeOptions OfficeIMO.Visio.VisioContainerOptions? = null optional
Align 2 overloads
public static VisioShapeSelection Align(VisioShapeSelection selection, VisioHorizontalAlignment alignment) #

Aligns selected shapes horizontally inside the current selection bounds.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to align.
alignment OfficeIMO.Visio.VisioHorizontalAlignment required
Horizontal alignment.
public static VisioShapeSelection Align(VisioShapeSelection selection, VisioVerticalAlignment alignment) #

Aligns selected shapes vertically inside the current selection bounds.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to align.
alignment OfficeIMO.Visio.VisioVerticalAlignment required
Vertical alignment.
ApplyStencilMigration 2 overloads
public static VisioStencilMigrationResult ApplyStencilMigration(VisioShapeSelection selection, VisioStencilMigrationMap map) #

Applies a stencil migration map to a page-backed shape selection.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
map OfficeIMO.Visio.VisioStencilMigrationMap required
public static VisioStencilMigrationResult ApplyStencilMigration(VisioShapeSelection selection, VisioStencilMigrationPlan plan, VisioStencilMigrationMap map) #

Applies a previously reviewed stencil migration plan to a page-backed selection. Every planned shape must still be part of the selection.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to update.
plan OfficeIMO.Visio.VisioStencilMigrationPlan required
Reviewed migration plan.
map OfficeIMO.Visio.VisioStencilMigrationMap required
Migration map used to create the plan.
public static VisioShapeSelection ApplyStyle(VisioShapeSelection selection, VisioShapeStyle style) #

Applies a reusable style to a shape selection.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
style OfficeIMO.Visio.VisioShapeStyle required
public static VisioShapeSelection ApplyTextStyle(VisioShapeSelection selection, VisioTextStyle style) #

Applies a reusable text style to a shape selection.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
style OfficeIMO.Visio.VisioTextStyle required
public static VisioShapeSelection Distribute(VisioShapeSelection selection, VisioDistributionAxis axis) #

Distributes selected shapes by center point along the requested axis.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to distribute.
axis OfficeIMO.Visio.VisioDistributionAxis required
Distribution axis.
public static VisioShapeSelection DistributeHorizontally(VisioShapeSelection selection) #

Distributes selected shapes horizontally by center point.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to distribute.
public static VisioShapeSelection DistributeVertically(VisioShapeSelection selection) #

Distributes selected shapes vertically by center point.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to distribute.
Duplicate 2 overloads
public static VisioShapeSelection Duplicate(VisioShapeSelection selection, double offsetX = 0.35, double offsetY = -0.35, bool includeInternalConnectors = true) #

Duplicates a page-backed selection on the same page.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to duplicate.
offsetX double = 0.35 optional
Horizontal offset for duplicated top-level shapes and page-coordinate routing points.
offsetY double = -0.35 optional
Vertical offset for duplicated top-level shapes and page-coordinate routing points.
includeInternalConnectors bool = true optional
Whether connectors whose attached shapes are all duplicated should also be copied, including partial connectors.

Returns

VisioShapeSelection A selection containing the duplicated root shapes.
public static VisioShapeSelection Duplicate(VisioShapeSelection selection, VisioShapeDuplicationOptions? options) #

Duplicates a page-backed selection on the same page.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to duplicate.
options OfficeIMO.Visio.VisioShapeDuplicationOptions? required
Optional duplication settings.

Returns

VisioShapeSelection A selection containing the duplicated root shapes.
public static VisioShapeBounds GetShapeBounds(VisioShapeSelection selection) #

Gets the bounds of a shape selection.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to inspect.
public static VisioStencilMigrationPlan PlanStencilMigration(VisioShapeSelection selection, VisioStencilMigrationMap map) #

Plans a stencil migration map for a page-backed shape selection without modifying the page.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
map OfficeIMO.Visio.VisioStencilMigrationMap required
RelayoutAsGrid 2 overloads
public static VisioShapeSelection RelayoutAsGrid(VisioShapeSelection selection, int columns = 0, double horizontalSpacing = 0.5, double verticalSpacing = 0.5, bool routeInternalConnectors = true) #

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

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to relayout.
columns int = 0 optional
Number of columns. When zero, OfficeIMO uses a near-square grid.
horizontalSpacing double = 0.5 optional
Horizontal spacing between columns in inches.
verticalSpacing double = 0.5 optional
Vertical spacing between rows in inches.
routeInternalConnectors bool = true optional
Whether connectors whose endpoints are both selected should be rerouted orthogonally.
public static VisioShapeSelection RelayoutAsGrid(VisioShapeSelection selection, VisioSelectionLayoutOptions? options) #

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

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to relayout.
options OfficeIMO.Visio.VisioSelectionLayoutOptions? required
Layout options.
public static VisioShapeSelection RelayoutAsHorizontalStack(VisioShapeSelection selection, double spacing = 0.5, bool routeInternalConnectors = true) #

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

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to relayout.
spacing double = 0.5 optional
Horizontal spacing between shapes in inches.
routeInternalConnectors bool = true optional
Whether connectors whose endpoints are both selected should be rerouted orthogonally.
public static VisioShapeSelection RelayoutAsVerticalStack(VisioShapeSelection selection, double spacing = 0.5, bool routeInternalConnectors = true) #

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

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to relayout.
spacing double = 0.5 optional
Vertical spacing between shapes in inches.
routeInternalConnectors bool = true optional
Whether connectors whose endpoints are both selected should be rerouted orthogonally.
public static VisioShapeSelection RemoveFromContainer(VisioShapeSelection selection, VisioShape container, bool resizeToFit = true, VisioContainerOptions? resizeOptions = null) #

Removes all selected shapes from an existing Visio-native container.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
container OfficeIMO.Visio.VisioShape required
resizeToFit bool = true optional
resizeOptions OfficeIMO.Visio.VisioContainerOptions? = null optional
ReplaceMaster 3 overloads
public static VisioShapeSelection ReplaceMaster(VisioShapeSelection selection, string masterNameU, bool resizeToMaster = false) #

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

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to update.
masterNameU string required
Replacement master universal name.
resizeToMaster bool = false optional
Whether to resize each shape to the replacement master's default size.

Returns

VisioShapeSelection The updated selection.
public static VisioShapeSelection ReplaceMaster(VisioShapeSelection selection, VisioMaster master, bool resizeToMaster = false) #

Replaces the master for every shape in a page-backed selection using an existing master instance.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to update.
master OfficeIMO.Visio.VisioMaster required
Replacement master.
resizeToMaster bool = false optional
Whether to resize each shape to the replacement master's default size.

Returns

VisioShapeSelection The updated selection.
public static VisioShapeSelection ReplaceMaster(VisioShapeSelection selection, VisioStencilShape stencil, bool resizeToMaster = false) #

Replaces the master for every shape in a page-backed selection using an OfficeIMO-native stencil definition.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to update.
stencil OfficeIMO.Visio.Stencils.VisioStencilShape required
Replacement stencil definition.
resizeToMaster bool = false optional
Whether to resize each shape to the stencil's default size.

Returns

VisioShapeSelection The updated selection.
public static VisioShapeSelection ResizeToText(VisioShapeSelection selection, OfficeFontInfo? fontInfo = null, double horizontalPadding = 0.25, double verticalPadding = 0.14, double minimumWidth = 0.5, double minimumHeight = 0.3) #

Resizes selected shapes to fit their plain text using deterministic OfficeIMO.Drawing measurement.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to resize.
fontInfo OfficeIMO.Drawing.OfficeFontInfo? = null optional
Font descriptor used for measurement. Uses Office default when omitted.
horizontalPadding double = 0.25 optional
Horizontal padding in inches.
verticalPadding double = 0.14 optional
Vertical padding in inches.
minimumWidth double = 0.5 optional
Minimum resulting width in inches.
minimumHeight double = 0.3 optional
Minimum resulting height in inches.
public static VisioShape WrapInContainer(VisioShapeSelection selection, string id, string text, VisioContainerOptions? options = null) #

Creates a Visio-native container around the selected shapes.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
id string required
text string required
options OfficeIMO.Visio.VisioContainerOptions? = null optional

Returns

VisioShape