# Set-OfficeVisioShapeLayout

Applies OfficeIMO Visio selection layout and layer operations to shapes.

Cmdlet 

Aliases: VisioLayout

**Module**

`PSWriteOffice`

**Aliases**

`VisioLayout`

**Inputs**

`System.Object`

**Outputs**

`OfficeIMO.Visio.VisioShape`

**Source**

[SetOfficeVisioShapeLayoutCommand.cs:24](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Visio/SetOfficeVisioShapeLayoutCommand.cs#L24) 

Applies OfficeIMO Visio selection layout and layer operations to shapes.

## Syntax

```
Set-OfficeVisioShapeLayout
[-Distribute <Horizontal|Vertical>]
[-HorizontalAlignment <Left|Center|Right>]
[[-InputObject] <Object>]
[-Layer <String>]
[-Page <VisioPage>]
[-PassThru]
[-ShapeId <String[]>]
[-VerticalAlignment <Bottom|Middle|Top>]
[<CommonParameters>]
```

[#](#method-set-officevisioshapelayout-visiodistributionaxis-visiohorizontalalignment-object-string-visiopage-switchparameter-string-visioverticalalignment)

Parameter set: `Alignment`

```
Set-OfficeVisioShapeLayout
[-Columns <Int32>]
-Grid
[-HorizontalSpacing <OfficeLength>]
[[-InputObject] <Object>]
[-Layer <String>]
[-NoRouteInternalConnectors]
[-Page <VisioPage>]
[-PassThru]
[-PreserveFirstShapeCenter]
[-ShapeId <String[]>]
[-VerticalSpacing <OfficeLength>]
[<CommonParameters>]
```

[#](#method-set-officevisioshapelayout-int32-switchparameter-officelength-object-string-switchparameter-visiopage-switchparameter-switchparameter-string-officelength)

Parameter set: `Grid`

```
Set-OfficeVisioShapeLayout
[-HorizontalSpacing <OfficeLength>]
-HorizontalStack
[[-InputObject] <Object>]
[-Layer <String>]
[-NoRouteInternalConnectors]
[-Page <VisioPage>]
[-PassThru]
[-ShapeId <String[]>]
[<CommonParameters>]
```

[#](#method-set-officevisioshapelayout-officelength-switchparameter-object-string-switchparameter-visiopage-switchparameter-string)

Parameter set: `HorizontalStack`

```
Set-OfficeVisioShapeLayout
[[-InputObject] <Object>]
[-Layer <String>]
[-NoRouteInternalConnectors]
[-Page <VisioPage>]
[-PassThru]
[-ShapeId <String[]>]
[-VerticalSpacing <OfficeLength>]
-VerticalStack
[<CommonParameters>]
```

[#](#method-set-officevisioshapelayout-object-string-switchparameter-visiopage-switchparameter-string-officelength-switchparameter)

Parameter set: `VerticalStack`

## Examples

### Arrange keyed shapes in a horizontal stack.

```powershell
OfficeVisio -Path .\Layout.vsdx {
    VisioRectangle -Key one -Text 'One'
    VisioRectangle -Key two -Text 'Two'
    VisioLayout -ShapeId one,two -HorizontalStack -HorizontalSpacing 0.4in
}
```

Resolves keyed shapes and applies a reusable OfficeIMO Visio layout operation.

## Parameters

**-Distribute VisioDistributionAxis optionalsets: Alignment**

Distribute selected shapes along an axis.

Possible values: `Horizontal`, `Vertical`

**-HorizontalAlignment VisioHorizontalAlignment optionalsets: Alignment**

Horizontal alignment inside the selected shapes' bounds.

Possible values: `Left`, `Center`, `Right`

**-InputObject Object optionalposition: 0pipeline: True (ByValue)**

Shapes, shape selections, or shape keys/ids to arrange.

**-Layer String optional**

Add selected shapes to this layer.

**-Page VisioPage optional**

Page that owns the shapes. Optional inside OfficeVisio/VisioPage DSL scopes.

**-PassThru SwitchParameter optional**

Emit arranged shapes.

**-ShapeId String[] optional**

Shape keys or ids to resolve on the target page.

**-VerticalAlignment VisioVerticalAlignment optionalsets: Alignment**

Vertical alignment inside the selected shapes' bounds.

Possible values: `Bottom`, `Middle`, `Top`

**-Columns Int32 optionalsets: Grid**

Grid column count. Zero lets OfficeIMO choose a near-square grid.

**-Grid SwitchParameter requiredsets: Grid**

Lay out selected shapes as a grid.

**-HorizontalSpacing OfficeLength optionalsets: Grid, HorizontalStack**

Horizontal spacing; a number means points for grid/stack layout.

**-NoRouteInternalConnectors SwitchParameter optionalsets: Grid, HorizontalStack, VerticalStack**

Do not reroute internal connectors during OfficeIMO relayout.

**-PreserveFirstShapeCenter SwitchParameter optionalsets: Grid**

Use the first selected shape as the grid origin instead of preserving the selection top-left.

**-VerticalSpacing OfficeLength optionalsets: Grid, VerticalStack**

Vertical spacing; a number means points for grid/stack layout.

**-HorizontalStack SwitchParameter requiredsets: HorizontalStack**

Lay out selected shapes as a horizontal stack.

**-VerticalStack SwitchParameter requiredsets: VerticalStack**

Lay out selected shapes as a vertical stack.

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:CC411489FAF3A6433ABCB2CBBF72A9161BD4A19BC49FB571D2FE70F9AD9481EB -->
