API Reference
Cmdlet
New-OfficeOpenDocument
Creates a native ODT, ODS, or ODP document.
Remarks
Creates a native ODT, ODS, or ODP document.
Examples
Create an OpenDocument text report.
PS>
New-OfficeOpenDocument -Kind Text -Path .\Report.odt -Content {
Add-OfficeOpenDocumentHeading -Text 'Service report' -Level 1
Add-OfficeOpenDocumentParagraph -Text 'Generated by PSWriteOffice.'
}
Create a spreadsheet with typed cells.
PS>
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
}
}
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.
Syntax
New-OfficeOpenDocument [-Content <ScriptBlock>] -Kind <Text|Spreadsheet|Presentation> [-NoSave] [-PassThru] [-Path <String>] [<CommonParameters>]#Parameter set:
All Parameter SetsParameters
- Content ScriptBlock
- DSL scriptblock describing OpenDocument text, spreadsheet, or presentation content.
- Kind OdfDocumentKind
- OpenDocument text, spreadsheet, or presentation kind.
- Possible values:
Text,Spreadsheet,Presentation - 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.
Outputs
OfficeIMO.OpenDocument.OdfDocument, System.IO.FileInfo