# New-OfficeVisio

Creates a Visio document with an initial page, returning it live or saving a completed content block.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`None`

**Outputs**

`OfficeIMO.Visio.VisioDocument` `System.IO.FileInfo`

**Source**

[NewOfficeVisioCommand.cs:22](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Visio/NewOfficeVisioCommand.cs#L22) 

Creates a Visio document with an initial page, returning it live or saving a completed content block.

## Syntax

```
New-OfficeVisio
[-Author <String>]
[-DisplayUnit <Inches|Centimeters|Millimeters>]
[-Force]
[-Height <OfficeLength>]
[-PageName <String>]
[[-Path] <String>]
[-RequestRecalcOnOpen]
[-Title <String>]
[-UseMastersByDefault]
[-Width <OfficeLength>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-new-officevisio-string-visiomeasurementunit-switchparameter-officelength-string-string-switchparameter-string-switchparameter-officelength-switchparameter-switchparameter)

Parameter set: `Live`

```
New-OfficeVisio
[-AllowLoss]
[-Author <String>]
[-Content] <ScriptBlock>
[-DisplayUnit <Inches|Centimeters|Millimeters>]
[-Force]
[-Height <OfficeLength>]
[-PageName <String>]
[-PassThru]
[-Path] <String>
[-RequestRecalcOnOpen]
[-Show]
[-Title <String>]
[-UseMastersByDefault]
[-Width <OfficeLength>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#member-01514c8d0b80c0e2096e5e9b)

Parameter set: `Content`

## Description

Without a block no file is written. A block publishes only after success; an existing destination requires Force. Geometry carries its own unit; DisplayUnit controls the page rulers.

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [Choose a PSWriteOffice Workflow](/docs/pswriteoffice/choosing-a-workflow/) Guide
  
  Decide between authoring, editing, inspection, conversion, and normalized Reader extraction. Includes examples and cmdlet links.
- [Automate Visio Diagrams](/docs/pswriteoffice/visio/) Guide
  
  Create, inspect, arrange, stencil, and export VSDX diagrams from PowerShell. Includes PowerShell examples, validation notes, and cmdlet links.
- [Use Visio Stencils and Shape Catalogs](/docs/visio/stencils-and-catalogs/) Guide
  
  Place shapes from OfficeIMO's built-in catalogs or from VSSX and VSTX stencil packs you supply, and keep the link to each shape's master.
- [Create, Edit, and Export Visio Diagrams](/docs/visio/) Guide
  
  OfficeIMO.Visio creates, edits, validates and exports VSDX diagrams in .NET without Microsoft Visio, with builders for common diagram types.

## Examples

### Create and save a service map.

```powershell
New-OfficeVisio -Path ./ServiceMap.vsdx -Title 'Service map' {
    VisioRectangle -Key web -Text 'Web' -X 1in -Y 4in
    VisioRectangle -Key api -Text 'API' -X 4in -Y 4in
    VisioConnector -From web -To api -Label 'calls'
}
```

### Create a live landscape diagram and save it explicitly.

```powershell
$diagram = New-OfficeVisio -Width 11in -Height 8.5in
Save-OfficeVisio -Document $diagram -Path ./Landscape.vsdx
```

## Parameters

**-Author String optional**

Optional document author.

**-DisplayUnit VisioMeasurementUnit optional**

Measurement unit displayed by Visio, independent of geometry input units.

Possible values: `Inches`, `Centimeters`, `Millimeters`

**-Force SwitchParameter optional**

Allow a completed content block to replace an existing destination.

**-Height OfficeLength optional**

Initial page height; defaults to A4 portrait.

**-PageName String optional**

Initial page name.

**-Path String required in Contentposition: 0aliases: FilePath**

Optional associated destination for a live document; required when a content block saves a file.

**-RequestRecalcOnOpen SwitchParameter optional**

Ask Visio to recalculate layout and connector routing on opening.

**-Title String optional**

Optional document title.

**-UseMastersByDefault SwitchParameter optional**

Use Visio masters for supported built-in stencil shapes when saving.

**-Width OfficeLength optional**

Initial page width; defaults to A4 portrait.

**-WhatIf SwitchParameter optional**

Shows what would happen if the command runs.

**-Confirm SwitchParameter optional**

Prompts for confirmation before running the command.

**-AllowLoss SwitchParameter optionalsets: Content**

Explicitly accept reductions reported by the content block's native save.

**-Content ScriptBlock requiredposition: 1sets: Content**

Authoring block to complete before the document is atomically saved and closed.

**-PassThru SwitchParameter optionalsets: Content**

Return the saved FileInfo after a completed content block.

**-Show SwitchParameter optionalsets: Content**

Open the saved result in its registered application after the content block succeeds.

## 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:CA0EF4D6C281B08D2AD2777F25585C684B7DD043477D13AFF416503FAB965F65 -->
