API Reference
Get-OfficeWordList
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
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>]#PathParameters
- IncludeEmpty SwitchParameter
- Include numbering definitions that do not currently have list items.
- InputPath String
- Path to the document to open read-only for list inspection.
Outputs
OfficeIMO.Word.WordList
Get-OfficeWordList -Document <WordDocument> [-IncludeEmpty] [<CommonParameters>]#DocumentParameters
- Document WordDocument
- Open document to inspect. The caller controls the document lifetime.
- IncludeEmpty SwitchParameter
- Include numbering definitions that do not currently have list items.
Outputs
OfficeIMO.Word.WordList
Get-OfficeWordList [-IncludeEmpty] -Section <WordSection> [<CommonParameters>]#SectionParameters
- IncludeEmpty SwitchParameter
- Include numbering definitions that do not currently have list items.
- Section WordSection
- Section to inspect when the caller only wants lists in a specific section.
Outputs
OfficeIMO.Word.WordList