Cmdlet
New-OfficeOpenDocument
Creates an ODT, ODS, ODP or ODG model, returning it live or saving a completed content block.
Syntax
New-OfficeOpenDocument
[-Force]
[-Kind <Text| Spreadsheet| Presentation| Graphics>]
[[-Path] <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]#Parameter set:
LiveNew-OfficeOpenDocument
[-AllowLoss]
[-Content] <ScriptBlock>
[-Force]
[-Kind <Text| Spreadsheet| Presentation| Graphics>]
[-PassThru]
[-Path] <String>
[-Show]
[-WhatIf]
[-Confirm]
[<CommonParameters>]#Parameter set:
ContentDescription
Kind is inferred from Path when omitted. Without a block no file is written. A block publishes only after success; an existing destination requires Force.
Examples
Create a text report and save the completed block.
New-OfficeOpenDocument -Path ./Report.odt {
Add-OfficeOpenDocumentHeading -Text 'Service report' -Level 1
Add-OfficeOpenDocumentParagraph -Text 'All services are available.'
}Create a live drawing and save it explicitly.
$drawing = New-OfficeOpenDocument -Path ./Overview.odg
$page = $drawing.AddPage('Overview')
Save-OfficeOpenDocument -Document $drawingParameters
- -Force SwitchParameter
- Allow a completed content block to replace an existing destination.
- -Kind OdfDocumentKind
- Document kind; required when no destination extension is supplied.
- Possible values:
Text,Spreadsheet,Presentation,Graphics - -Path String
- Optional associated destination for a live document; required when a content block saves a file.
- -WhatIf SwitchParameter
- Shows what would happen if the command runs.
- -Confirm SwitchParameter
- Prompts for confirmation before running the command.
- -AllowLoss SwitchParameter
- Explicitly accept reductions reported by the content block's native save.
- -Content ScriptBlock
- Authoring block to complete before the document is atomically saved and closed.
- -PassThru SwitchParameter
- Return the saved FileInfo after a completed content block.
- -Show SwitchParameter
- 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.