Cmdlet
Add-OfficeWordParagraph
Adds a paragraph to the current section/header/footer context.
Syntax
Add-OfficeWordParagraph
[-Alignment <OfficeAlignment>]
[-Document <WordDocument>]
[-PassThru]
[-Style <WordParagraphStyles>]
[-StyleId <String>]
[[-Text] <String>]
[<CommonParameters>]#Parameter set:
TextAdd-OfficeWordParagraph
[-Alignment <OfficeAlignment>]
[-Content] <ScriptBlock>
[-Document <WordDocument>]
[-PassThru]
[-Style <WordParagraphStyles>]
[-StyleId <String>]
[<CommonParameters>]#Parameter set:
ContentAdd-OfficeWordParagraph
[-Alignment <OfficeAlignment>]
[-PassThru]
-Section <WordSection>
[-Style <WordParagraphStyles>]
[-StyleId <String>]
[[-Text] <String>]
[<CommonParameters>]#Parameter set:
SectionTextAdd-OfficeWordParagraph
[-Alignment <OfficeAlignment>]
[-Content] <ScriptBlock>
[-PassThru]
-Section <WordSection>
[-Style <WordParagraphStyles>]
[-StyleId <String>]
[<CommonParameters>]#Parameter set:
SectionContentDescription
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 'Owner: ' -Bold
$paragraph | Add-OfficeWordText 'Platform'Creates a paragraph on a live document and appends two differently formatted runs.
Parameters
- -Alignment OfficeAlignment
- Paragraph justification.
- Possible values:
Left,Center,Right,Justify,Start,End - -Document WordDocument
- Live document to receive the paragraph; omitted in a content block.
- -PassThru SwitchParameter
- Emit the WordParagraph for further use.
- -Style WordParagraphStyles
- Paragraph style.
- Possible values:
Normal,Heading1,Heading2,Heading3,Heading4,Heading5,Heading6,Heading7,Heading8,Heading9,ListParagraph,Custom,Title,Subtitle - -StyleId String
- Paragraph style id, including custom style ids from a template document.
- -Text String
- Initial paragraph text; omission creates an empty paragraph.
- -Content ScriptBlock
- Nested WordText and inline content.
- -Section WordSection
- Section to receive the paragraph.
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.