Project

PSWriteOffice

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

Stars 165
Forks 15
PowerShell Gallery downloads 158,661
Release v3.0.8
Language: C# Updated: 2026-10-12

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, ODP, or ODG document.

Remarks

Creates a native ODT, ODS, ODP, or ODG 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 an OpenDocument drawing through its native object model.

PS>


$drawing = New-OfficeOpenDocument -Kind Graphics
            $page = $drawing.AddPage('Overview')
            $drawing | Save-OfficeOpenDocument -Path .\Overview.odg
        

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|Graphics> [-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: 4
OpenDocument text, spreadsheet, presentation, or graphics kind.
Possible values: Text, Spreadsheet, Presentation, Graphics
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