Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

New-OfficeVisio

Module
PSWriteOffice
Inputs
None
Outputs
OfficeIMO.Visio.VisioDocument System.IO.FileInfo

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>]
#
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>]
#
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.

Examples

Create and save a service map.

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.

$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.