Add-OfficeWordSection
Adds or reuses a section inside the current Word document.
Syntax
Add-OfficeWordSection
[-BreakType <NextPage| NextColumn| Continuous| EvenPage| OddPage>]
[[-Content] <ScriptBlock>]
[-PassThru]
[<CommonParameters>]#ContextAdd-OfficeWordSection
[-BreakType <NextPage| NextColumn| Continuous| EvenPage| OddPage>]
[[-Content] <ScriptBlock>]
-Document <WordDocument>
[-PassThru]
[<CommonParameters>]#DocumentDescription
Provides the DSL entry point for section-level operations inside New-OfficeWord.
Examples
Create a section with a paragraph.
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.
$section = $document | Add-OfficeWordSection -BreakType NextPage -PassThru
$section | Add-OfficeWordParagraph -Text 'Appendix' -Style Heading1Adds a section through the document pipeline and uses the returned section as the next explicit target.
Parameters
- -BreakType WordSectionBreakType
- Optional section break type.
- Possible values:
NextPage,NextColumn,Continuous,EvenPage,OddPage - -Content ScriptBlock
- DSL scriptblock executed within the section scope.
- -PassThru SwitchParameter
- Emit the created WordSection.
- -Document WordDocument
- Document that will receive a new section.
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.