API Reference
Find-OfficeWordList
Finds Word lists containing matching list-item text.
Remarks
Searches list items in a Word document or section and returns matching WordList objects. This is useful when a document has an existing checklist or numbered list and the script needs to append to that list rather than create a new one elsewhere in the document. Use -Text for literal contains matching or -Pattern for regular expressions. The returned list objects can be piped directly to Add-OfficeWordListItem.
Examples
Find an existing checklist and append another item.
PS>
$doc = Get-OfficeWord -Path .\Report.docx
Find-OfficeWordList -Document $doc -Text 'Initial review' |
Add-OfficeWordListItem -Text 'Final approval'
Searches list-item paragraphs and returns matching OfficeIMO list objects for further editing.
Append several follow-up items to an existing checklist.
PS>
$doc = Get-OfficeWord -Path .\Handover.docx
$list = Find-OfficeWordList -Document $doc -Text 'Initial review' | Select-Object -First 1
$list | Add-OfficeWordListItem -Text 'Business sign-off'
$list | Add-OfficeWordListItem -Text 'Go-live approval'
$doc | Close-OfficeWord -Save
Finds a checklist by an item it already contains and appends new items to the same list.
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
Find-OfficeWordList [-CaseSensitive] -InputPath <String> -Text <String> [<CommonParameters>]#PathTextParameters
- CaseSensitive SwitchParameter
- Use case-sensitive matching.
- InputPath String
- Path to the document to open read-only for searching.
- Text String
- Literal text to find in list items.
Outputs
OfficeIMO.Word.WordList
Find-OfficeWordList [-CaseSensitive] -InputPath <String> -Pattern <String> [<CommonParameters>]#PathRegexParameters
- CaseSensitive SwitchParameter
- Use case-sensitive matching.
- InputPath String
- Path to the document to open read-only for searching.
- Pattern String
- Regular expression pattern to find in list items.
Outputs
OfficeIMO.Word.WordList
Find-OfficeWordList [-CaseSensitive] -Document <WordDocument> -Text <String> [<CommonParameters>]#DocumentTextParameters
- CaseSensitive SwitchParameter
- Use case-sensitive matching.
- Document WordDocument
- Open document to inspect. The caller controls the document lifetime.
- Text String
- Literal text to find in list items.
Outputs
OfficeIMO.Word.WordList
Find-OfficeWordList [-CaseSensitive] -Document <WordDocument> -Pattern <String> [<CommonParameters>]#DocumentRegexParameters
- CaseSensitive SwitchParameter
- Use case-sensitive matching.
- Document WordDocument
- Open document to inspect. The caller controls the document lifetime.
- Pattern String
- Regular expression pattern to find in list items.
Outputs
OfficeIMO.Word.WordList
Find-OfficeWordList [-CaseSensitive] -Section <WordSection> -Text <String> [<CommonParameters>]#SectionTextParameters
- CaseSensitive SwitchParameter
- Use case-sensitive matching.
- Section WordSection
- Section to inspect when the caller only wants lists in a specific section.
- Text String
- Literal text to find in list items.
Outputs
OfficeIMO.Word.WordList
Find-OfficeWordList [-CaseSensitive] -Pattern <String> -Section <WordSection> [<CommonParameters>]#SectionRegexParameters
- CaseSensitive SwitchParameter
- Use case-sensitive matching.
- Pattern String
- Regular expression pattern to find in list items.
- Section WordSection
- Section to inspect when the caller only wants lists in a specific section.
Outputs
OfficeIMO.Word.WordList