Get-OfficeWordList
Gets lists from a Word document or section.
Syntax
Description
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.
$doc = Get-OfficeWord -Path .\Report.docx
$list = $doc | Get-OfficeWordList | Select-Object -First 1
$list.ListItems | Select-Object -Property TextReturns OfficeIMO list objects so existing list items can be reviewed or appended to.
Select a checklist by existing item text and append an item.
$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 -SaveInspects list objects directly when the caller wants custom selection logic.
Parameters
- -IncludeEmpty SwitchParameter
- Include numbering definitions that do not currently have list items.
- -Path String
- Path to the document to open read-only for list inspection.
- -Document WordDocument
- Open document to inspect. The caller controls the document lifetime.
- -Section WordSection
- Section to inspect when the caller only wants lists in a specific section.
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.