API Reference

Class

VisioLayoutExtensions

Namespace OfficeIMO.Visio
Assembly OfficeIMO.Visio
Modifiers static

Layout and geometry helpers for Visio pages, shapes, and selections.

Inheritance

  • Object
  • VisioLayoutExtensions

Methods

Align 2 overloads
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.
Align(OfficeIMO.Visio.VisioShapeSelection selection, OfficeIMO.Visio.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.
public static VisioPage CenterContent(VisioPage page) #
Returns: VisioPage

Centers top-level page shapes within the current page size.

Parameters

page OfficeIMO.Visio.VisioPage requiredposition: 0
Page to update.
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.
FitToContent 2 overloads
public static VisioPage FitToContent(VisioPage page, Double margin = 0.5, Boolean resizePage = true) #
Returns: VisioPage

Moves top-level page shapes so content starts at the requested margin and optionally resizes the page to fit.

Parameters

page OfficeIMO.Visio.VisioPage requiredposition: 0
Page to update.
margin System.Double = 0.5 optionalposition: 1
Margin in inches around content.
resizePage System.Boolean = true optionalposition: 2
Whether to resize the page around the content.
public static VisioPage FitToContent(VisioPage page, Double horizontalMargin, Double verticalMargin, Boolean resizePage = true) #
Returns: VisioPage

Moves top-level page shapes so content starts at the requested margins and optionally resizes the page to fit.

Parameters

page OfficeIMO.Visio.VisioPage requiredposition: 0
Page to update.
horizontalMargin System.Double requiredposition: 1
Horizontal margin in inches.
verticalMargin System.Double requiredposition: 2
Vertical margin in inches.
resizePage System.Boolean = true optionalposition: 3
Whether to resize the page around the content.
public static VisioShapeBounds GetContentBounds(VisioPage page, Boolean includeGroupChildren = false, Boolean includeConnectors = true) #
Returns: VisioShapeBounds

Gets bounds of visible page content, including shapes, explicit connector routes, and connector label boxes.

Parameters

page OfficeIMO.Visio.VisioPage requiredposition: 0
Page to inspect.
includeGroupChildren System.Boolean = false optionalposition: 1
Whether nested group children should be included using their stored coordinates.
includeConnectors System.Boolean = true optionalposition: 2
Whether connector waypoints and label boxes should be included.
GetShapeBounds 3 overloads
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.
GetShapeBounds(System.Collections.Generic.IEnumerable{OfficeIMO.Visio.VisioShape} shapes) #

Gets aggregate bounds for a shape sequence.

Parameters

shapes System.Collections.Generic.IEnumerable{OfficeIMO.Visio.VisioShape} required
Shapes to inspect.
GetShapeBounds(OfficeIMO.Visio.VisioShapeSelection selection) #

Gets the bounds of a shape selection.

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection 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.
public static VisioConnectorSelection ResizeLabelsToText(VisioConnectorSelection selection, Nullable<OfficeFontInfo> fontInfo = null, Double horizontalPadding = 0.12, Double verticalPadding = 0.06, Double minimumWidth = 0.45, Double minimumHeight = 0.22, Nullable<Double> maximumWidth = null) #
Returns: VisioConnectorSelection

Resizes selected connector label text boxes to fit their plain text using deterministic OfficeIMO.Drawing measurement.

Parameters

selection OfficeIMO.Visio.VisioConnectorSelection requiredposition: 0
Connector selection.
fontInfo System.Nullable{OfficeIMO.Drawing.OfficeFontInfo} = null optionalposition: 1
Font descriptor used for measurement. Uses connector text style, then Office default, when omitted.
horizontalPadding System.Double = 0.12 optionalposition: 2
Horizontal padding in inches.
verticalPadding System.Double = 0.06 optionalposition: 3
Vertical padding in inches.
minimumWidth System.Double = 0.45 optionalposition: 4
Minimum resulting label width in inches.
minimumHeight System.Double = 0.22 optionalposition: 5
Minimum resulting label height in inches.
maximumWidth System.Nullable{System.Double} = null optionalposition: 6
Optional maximum label width in inches. Text wraps by words when supplied.
public static VisioConnector ResizeLabelToText(VisioConnector connector, Nullable<OfficeFontInfo> fontInfo = null, Double horizontalPadding = 0.12, Double verticalPadding = 0.06, Double minimumWidth = 0.45, Double minimumHeight = 0.22, Nullable<Double> maximumWidth = null) #
Returns: VisioConnector

Resizes a connector label text box to fit its plain text using deterministic OfficeIMO.Drawing measurement.

Parameters

connector OfficeIMO.Visio.VisioConnector requiredposition: 0
Connector whose label box should be resized.
fontInfo System.Nullable{OfficeIMO.Drawing.OfficeFontInfo} = null optionalposition: 1
Font descriptor used for measurement. Uses connector text style, then Office default, when omitted.
horizontalPadding System.Double = 0.12 optionalposition: 2
Horizontal padding in inches.
verticalPadding System.Double = 0.06 optionalposition: 3
Vertical padding in inches.
minimumWidth System.Double = 0.45 optionalposition: 4
Minimum resulting label width in inches.
minimumHeight System.Double = 0.22 optionalposition: 5
Minimum resulting label height in inches.
maximumWidth System.Nullable{System.Double} = null optionalposition: 6
Optional maximum label width in inches. Text wraps by words when supplied.
ResizeToText 2 overloads
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.
ResizeToText(OfficeIMO.Visio.VisioShapeSelection selection, System.Nullable{OfficeIMO.Drawing.OfficeFontInfo} fontInfo, System.Double horizontalPadding, System.Double verticalPadding, System.Double minimumWidth, System.Double minimumHeight) #

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

Parameters

selection OfficeIMO.Visio.VisioShapeSelection required
Selection to resize.
fontInfo System.Nullable{OfficeIMO.Drawing.OfficeFontInfo} required
Font descriptor used for measurement. Uses Office default when omitted.
horizontalPadding System.Double required
Horizontal padding in inches.
verticalPadding System.Double required
Vertical padding in inches.
minimumWidth System.Double required
Minimum resulting width in inches.
minimumHeight System.Double required
Minimum resulting height in inches.
public static VisioPage ResolveConnectorLabelOverlaps(VisioPage page, Double step = 0.18, Int32 maxAttempts = 12, Boolean avoidShapes = true, Boolean avoidLabels = true) #
Returns: VisioPage

Moves connector label boxes away from page edges, unrelated shapes, and previously placed connector labels.

Parameters

page OfficeIMO.Visio.VisioPage requiredposition: 0
Page whose connector labels should be adjusted.
step System.Double = 0.18 optionalposition: 1
Search step in page units, expressed in inches.
maxAttempts System.Int32 = 12 optionalposition: 2
Number of search rings to try around the current label position.
avoidShapes System.Boolean = true optionalposition: 3
Whether labels should avoid unrelated non-container shapes.
avoidLabels System.Boolean = true optionalposition: 4
Whether labels should avoid other connector labels.
public static VisioPage ResolveShapeOverlaps(VisioPage page, Double step = 0.25, Int32 maxAttempts = 24, Boolean includeContainers = false) #
Returns: VisioPage

Moves overlapping top-level shapes apart using a deterministic nearest-open-position search.

Parameters

page OfficeIMO.Visio.VisioPage requiredposition: 0
Page to update.
step System.Double = 0.25 optionalposition: 1
Search step in inches.
maxAttempts System.Int32 = 24 optionalposition: 2
Number of search rings to try around each overlapping shape.
includeContainers System.Boolean = false optionalposition: 3
Whether container and background surface shapes should be moved and treated as obstacles.