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-OfficeWordParagraph

Aliases: WordParagraph
Namespace PSWriteOffice
Aliases
WordParagraph
Inputs
System.Object
Outputs
OfficeIMO.Word.WordParagraph

Adds a paragraph to the current section/header/footer context.

Remarks

Acts as the primary DSL container for inline content such as text runs, bold segments, and images.

Examples

Authored help example

Write a formatted sentence.

PS>


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.

PS>


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.

PS>


$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.

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-OfficeWordParagraph [-Alignment <Left>] [-PassThru] [-Run <Object[]>] [-Style <Normal>] [-StyleId <String>] [-Target <Object>] [-Text <String>] [<CommonParameters>]
#
Parameter set: Text

Parameters

Alignment WordParagraphAlignment optionalposition: namedpipeline: Falsevalues: 12
Paragraph justification.
Possible values: Left, Start, Center, Right, End, Both, MediumKashida, Distribute, NumTab, HighKashida, LowKashida, ThaiDistribute
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the WordParagraph for further use.
Run Object[] optionalposition: namedpipeline: Falsealiases: Runs
Rich text runs. Each run can be created with TextRun/WordTextRun or provided as a hashtable/object.
Style WordParagraphStyles optionalposition: namedpipeline: Falsevalues: 12
Paragraph style.
Possible values: Normal, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Heading7, Heading8, Heading9, ListParagraph, Custom
StyleId String optionalposition: namedpipeline: False
Paragraph style id, including custom style ids from a template document.
Target Object optionalposition: namedpipeline: True (ByValue)aliases: Document, Section
Document or section that will receive the paragraph.
Text String optionalposition: 0pipeline: False
Optional initial paragraph text.

Outputs

OfficeIMO.Word.WordParagraph

Add-OfficeWordParagraph [-Alignment <Left>] [-Content <ScriptBlock>] [-PassThru] [-Style <Normal>] [-StyleId <String>] [-Target <Object>] [-Text <String>] [<CommonParameters>]
#
Parameter set: Content

Parameters

Alignment WordParagraphAlignment optionalposition: namedpipeline: Falsevalues: 12
Paragraph justification.
Possible values: Left, Start, Center, Right, End, Both, MediumKashida, Distribute, NumTab, HighKashida, LowKashida, ThaiDistribute
Content ScriptBlock optionalposition: 0pipeline: False
Nested DSL content (runs, lists, images).
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the WordParagraph for further use.
Style WordParagraphStyles optionalposition: namedpipeline: Falsevalues: 12
Paragraph style.
Possible values: Normal, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Heading7, Heading8, Heading9, ListParagraph, Custom
StyleId String optionalposition: namedpipeline: False
Paragraph style id, including custom style ids from a template document.
Target Object optionalposition: namedpipeline: True (ByValue)aliases: Document, Section
Document or section that will receive the paragraph.
Text String optionalposition: 0pipeline: False
Optional initial paragraph text.

Outputs

OfficeIMO.Word.WordParagraph