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

Add-OfficeWordSection

Aliases: WordSection
Namespace PSWriteOffice
Aliases
WordSection
Inputs
OfficeIMO.Word.WordDocument
Outputs
OfficeIMO.Word.WordSection

Adds or reuses a section inside the current Word document.

Remarks

Provides the DSL entry point for section-level operations inside New-OfficeWord.

Examples

Authored help example

Create a section with a paragraph.

PS>


New-OfficeWord -Path .\doc.docx { Add-OfficeWordSection { Add-OfficeWordParagraph -Text 'Hello' } }
        

Creates a document and inserts a section that contains a single paragraph.

Add a section to a live document.

PS>


$section = $document | Add-OfficeWordSection -BreakType NextPage -PassThru
            $section | Add-OfficeWordParagraph -Text 'Appendix' -Style Heading1
        

Adds a section through the document pipeline and uses the returned section as the next explicit target.

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

Add-OfficeWordSection [-BreakType <NextPage|NextColumn|Continuous|EvenPage|OddPage>] [-Content <ScriptBlock>] [-PassThru] [<CommonParameters>]
#
Parameter set: Context

Parameters

BreakType WordSectionBreakType optionalposition: namedpipeline: Falsevalues: 5
Optional section break type.
Possible values: NextPage, NextColumn, Continuous, EvenPage, OddPage
Content ScriptBlock optionalposition: 0pipeline: False
DSL scriptblock executed within the section scope.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the created WordSection.

Outputs

OfficeIMO.Word.WordSection

Add-OfficeWordSection [-BreakType <NextPage|NextColumn|Continuous|EvenPage|OddPage>] [-Content <ScriptBlock>] -Document <WordDocument> [-PassThru] [<CommonParameters>]
#
Parameter set: Document

Parameters

BreakType WordSectionBreakType optionalposition: namedpipeline: Falsevalues: 5
Optional section break type.
Possible values: NextPage, NextColumn, Continuous, EvenPage, OddPage
Content ScriptBlock optionalposition: 0pipeline: False
DSL scriptblock executed within the section scope.
Document WordDocument requiredposition: namedpipeline: True (ByValue)
Document that will receive a new section.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the created WordSection.

Outputs

OfficeIMO.Word.WordSection