Add-OfficeWordParagraph
Adds a paragraph to the current section/header/footer context.
Syntax
Add-OfficeWordParagraph
[-Alignment <WordParagraphAlignment>]
[-PassThru]
[-Run <Object[]>]
[-Style <WordParagraphStyles>]
[-StyleId <String>]
[-Target <Object>]
[[-Text] <String>]
[<CommonParameters>]#TextAdd-OfficeWordParagraph
[-Alignment <WordParagraphAlignment>]
[[-Content] <ScriptBlock>]
[-PassThru]
[-Style <WordParagraphStyles>]
[-StyleId <String>]
[-Target <Object>]
[[-Text] <String>]
[<CommonParameters>]#ContentDescription
Acts as the primary DSL container for inline content such as text runs, bold segments, and images.
Examples
Write a formatted sentence.
Add-OfficeWordParagraph { Add-OfficeWordText -Text 'Hello '; Add-OfficeWordText -Text 'World' -Bold }Outputs “Hello World” with the second word bolded.
Apply a paragraph style by id.
WordParagraph -Text 'Executive summary' -StyleId 'ReportHeading'Applies a paragraph style id, including custom styles already present in a template document.
Add mixed-format text through explicit objects.
$paragraph = $document | Add-OfficeWordParagraph -PassThru
$paragraph | Add-OfficeWordText -Run @{ Text = 'Owner: ', 'Platform'; Bold = $true, $false }Creates a paragraph on a live document and appends two differently formatted runs.
Parameters
- -Alignment WordParagraphAlignment
- Paragraph justification.
- Possible values:
Left,Start,Center,Right,End,Both,MediumKashida,Distribute,NumTab,HighKashida,LowKashida,ThaiDistribute - -PassThru SwitchParameter
- Emit the WordParagraph for further use.
- -Run Object[]
- Rich text runs. Each run can be created with TextRun/WordTextRun or provided as a hashtable/object.
- -Style WordParagraphStyles
- Paragraph style.
- Possible values:
Normal,Heading1,Heading2,Heading3,Heading4,Heading5,Heading6,Heading7,Heading8,Heading9,ListParagraph,Custom - -StyleId String
- Paragraph style id, including custom style ids from a template document.
- -Target Object
- Document or section that will receive the paragraph.
- -Text String
- Optional initial paragraph text.
- -Content ScriptBlock
- Nested DSL content (runs, lists, images).
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.