Cmdlet
Add-OfficeWordText
Adds inline text to the current paragraph.
Syntax
Add-OfficeWordText
[-Bold]
[-Color <String>]
[-FontName <String>]
[-FontSize <Double>]
[-Italic]
[-Paragraph <WordParagraph>]
[-PassThru]
[-Strike]
[-Text] <String[]>
[-Underline <WordUnderlineStyle>]
[<CommonParameters>]#Parameter set:
TextAdd-OfficeWordText
[-Bold]
[-Color <String>]
[-FontName <String>]
[-FontSize <Double>]
[-Italic]
[-Paragraph <WordParagraph>]
[-PassThru]
-Run <Object[]>
[-Strike]
[-Underline <WordUnderlineStyle>]
[<CommonParameters>]#Parameter set:
RunDescription
Supports bold/italic/underline and color tweaks for quick DSL composition.
Examples
Append bold text.
Add-OfficeWordParagraph { Add-OfficeWordText -Text 'Important: ' -Bold }Writes “Important:” with bold formatting.
Append several styled segments to a paragraph.
$paragraph | Add-OfficeWordText -Run @{ Text = 'Status: ', 'Ready'; Bold = $true, $false; Color = $null, 'SeaGreen' }Appends one line with independent formatting for its label and value.
Parameters
- -Bold SwitchParameter
- Apply bold formatting.
- -Color String
- Run color. Named colors and hexadecimal values are accepted.
- -FontName String
- Font name or family.
- -FontSize Double
- Font size in points.
- -Italic SwitchParameter
- Apply italic formatting.
- -Paragraph WordParagraph
- Paragraph that will receive the text outside a DSL context.
- -PassThru SwitchParameter
- Emit the target paragraph for further composition.
- -Strike SwitchParameter
- Render text with strikethrough.
- -Text String[]
- Text segments to append.
- -Underline WordUnderlineStyle
- Optional underline style.
- Possible values:
Single,Words,Double,Thick,Dotted,DottedHeavy,Dash,DashedHeavy,DashLong,DashLongHeavy,DotDash,DashDotHeavy,DotDotDash,DashDotDotHeavy,Wave,WavyHeavy,WavyDouble - -Run Object[]
- Rich text runs. Each run can be created with TextRun/WordTextRun or provided as a hashtable/object.
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.