Cmdlet
New-OfficeOpenDocument
Creates a native ODT, ODS, ODP, or ODG document.
Syntax
New-OfficeOpenDocument [[-Content] <ScriptBlock>] [-Kind] <Text|Spreadsheet|Presentation|Graphics> [-NoSave] [-PassThru] [[-Path] <String>] [<CommonParameters>]#Parameter set:
All Parameter SetsExamples
Create an OpenDocument text report.
New-OfficeOpenDocument -Kind Text -Path .\Report.odt -Content {
Add-OfficeOpenDocumentHeading -Text 'Service report' -Level 1
Add-OfficeOpenDocumentParagraph -Text 'Generated by PSWriteOffice.'
}Create an OpenDocument drawing through its native object model.
$drawing = New-OfficeOpenDocument -Kind Graphics
$page = $drawing.AddPage('Overview')
$drawing | Save-OfficeOpenDocument -Path .\Overview.odgCreate a spreadsheet with typed cells.
New-OfficeOpenDocument -Kind Spreadsheet -Path .\Status.ods -Content {
Add-OfficeOpenDocumentSheet -Name 'Services' -Content {
Set-OfficeOpenDocumentCell -Row 0 -Column 0 -Value 'Service'
Set-OfficeOpenDocumentCell -Row 0 -Column 1 -Value 'Healthy'
Set-OfficeOpenDocumentCell -Row 1 -Column 0 -Value 'Directory'
Set-OfficeOpenDocumentCell -Row 1 -Column 1 -Value $true
}
}Parameters
- -Content ScriptBlock
- DSL scriptblock describing OpenDocument text, spreadsheet, or presentation content.
- -Kind OdfDocumentKind
- OpenDocument text, spreadsheet, presentation, or graphics kind.
- Possible values:
Text,Spreadsheet,Presentation,Graphics - -NoSave SwitchParameter
- Skip saving and emit the live OpenDocument model even when -Path is supplied.
- -PassThru SwitchParameter
- Emit the saved file when a destination path is supplied.
- -Path String
- Optional initial destination path.
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.