Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

New-OfficeOpenDocument

Aliases: OfficeOpenDocument, OpenDocumentNew
Namespace PSWriteOffice
Aliases
OfficeOpenDocument OpenDocumentNew
Inputs
None
Outputs
OfficeIMO.OpenDocument.OdfDocument System.IO.FileInfo

Creates a native ODT, ODS, or ODP document.

Remarks

Creates a native ODT, ODS, or ODP document.

Examples

Authored help example

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 Sets

Parameters

Content ScriptBlock optionalposition: 2pipeline: False
DSL scriptblock describing OpenDocument text, spreadsheet, or presentation content.
Kind OdfDocumentKind requiredposition: 0pipeline: Falsevalues: 3
OpenDocument text, spreadsheet, or presentation kind.
Possible values: Text, Spreadsheet, Presentation
NoSave SwitchParameter optionalposition: namedpipeline: False
Skip saving and emit the live OpenDocument model even when -Path is supplied.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the saved file when a destination path is supplied.
Path String optionalposition: 1pipeline: False
Optional initial destination path.

Outputs

OfficeIMO.OpenDocument.OdfDocument, System.IO.FileInfo