API Reference

Cmdlet

Get-OfficeWordList

Namespace PSWriteOffice
Inputs
OfficeIMO.Word.WordDocument OfficeIMO.Word.WordSection
Outputs
OfficeIMO.Word.WordList

Gets lists from a Word document or section.

Remarks

Returns existing WordList objects so scripts can inspect list items, report on checklist content, or pipe a selected list to Add-OfficeWordListItem. Use this command when the script needs to work with list objects directly instead of using a text search first.

Examples

Authored help example

Inspect existing list items.

PS>


$doc = Get-OfficeWord -Path .\Report.docx
            $list = $doc | Get-OfficeWordList | Select-Object -First 1
            $list.ListItems | Select-Object -Property Text
        

Returns OfficeIMO list objects so existing list items can be reviewed or appended to.

Select a checklist by existing item text and append an item.

PS>


$doc = Get-OfficeWord -Path .\Report.docx
            Get-OfficeWordList -Document $doc |
                Where-Object { $_.ListItems.Text -contains 'Initial review' } |
                Add-OfficeWordListItem -Text 'Final approval'
            $doc | Close-OfficeWord -Save
        

Inspects list objects directly when the caller wants custom selection logic.

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

Get-OfficeWordList [-IncludeEmpty] -InputPath <String> [<CommonParameters>]
#
Parameter set: Path

Parameters

IncludeEmpty SwitchParameter optionalposition: namedpipeline: False
Include numbering definitions that do not currently have list items.
InputPath String requiredposition: 0pipeline: Falsealiases: FilePath, Path
Path to the document to open read-only for list inspection.

Outputs

OfficeIMO.Word.WordList

Get-OfficeWordList -Document <WordDocument> [-IncludeEmpty] [<CommonParameters>]
#
Parameter set: Document

Parameters

Document WordDocument requiredposition: namedpipeline: True (ByValue)
Open document to inspect. The caller controls the document lifetime.
IncludeEmpty SwitchParameter optionalposition: namedpipeline: False
Include numbering definitions that do not currently have list items.

Outputs

OfficeIMO.Word.WordList

Get-OfficeWordList [-IncludeEmpty] -Section <WordSection> [<CommonParameters>]
#
Parameter set: Section

Parameters

IncludeEmpty SwitchParameter optionalposition: namedpipeline: False
Include numbering definitions that do not currently have list items.
Section WordSection requiredposition: namedpipeline: True (ByValue)
Section to inspect when the caller only wants lists in a specific section.

Outputs

OfficeIMO.Word.WordList