Find-OfficePowerPointShape
Finds PowerPoint shapes by text, name, kind, or slide.
Syntax
Find-OfficePowerPointShape [-CaseSensitive] [-Index <Int32>] [-Kind <OfficePowerPointShapeKind[]>] [-Name <String[]>] -Presentation <PowerPointPresentation> [-ShapeIndex <Int32[]>] [[-Text] <String>] [<CommonParameters>]#PresentationTextFind-OfficePowerPointShape [-CaseSensitive] [-Index <Int32>] [-Kind <OfficePowerPointShapeKind[]>] [-Name <String[]>] [-Pattern] <String> -Presentation <PowerPointPresentation> [-ShapeIndex <Int32[]>] [<CommonParameters>]#PresentationRegexFind-OfficePowerPointShape [-CaseSensitive] [-Kind <OfficePowerPointShapeKind[]>] [-Name <String[]>] [-ShapeIndex <Int32[]>] -Slide <PowerPointSlide> [[-Text] <String>] [<CommonParameters>]#SlideTextFind-OfficePowerPointShape [-CaseSensitive] [-Kind <OfficePowerPointShapeKind[]>] [-Name <String[]>] [-Pattern] <String> [-ShapeIndex <Int32[]>] -Slide <PowerPointSlide> [<CommonParameters>]#SlideRegexDescription
Searches an open presentation or a single slide and returns PowerPointShapeInfo records that include the slide index, shape index, shape kind, extracted text, shape name, and the underlying OfficeIMO shape object. Text matching includes normal text boxes and table cell text, so this command can locate the right object before piping it into modification commands.
Use -Text for literal contains matching or -Pattern for regular expressions, or omit both text parameters when -Kind, -Name, -Index, and -ShapeIndex identify the target shape without reading text content.
Examples
Find and update a text box.
Find-OfficePowerPointShape -Presentation $ppt -Text 'FY24' -Kind TextBox |
Set-OfficePowerPointShapeText -Text 'FY25'Finds matching text shapes and updates them without using the PowerPoint DSL.
Find a table by cell text and append a new status row.
$ppt = Get-OfficePowerPoint -Path .\Readiness.pptx
$table = Find-OfficePowerPointShape -Presentation $ppt -Text 'Risk' -Kind Table | Select-Object -First 1
$table | Add-OfficePowerPointTableRow -Values 'Latency', 'Investigating'
$ppt | Close-OfficePowerPoint -SaveUses table-cell text as the locator, then pipes the table shape metadata into a table-row edit.
Parameters
- -CaseSensitive SwitchParameter
- Use case-sensitive matching for text and name filters.
- -Index Int32
- Optional zero-based slide index when reading from a presentation.
- -Kind OfficePowerPointShapeKind[]
- Optional shape kind filter such as TextBox or Table.
- Possible values:
TextBox,Picture,Table,Chart,AutoShape,GroupShape - -Name String[]
- Optional wildcard filter for shape names.
- -Presentation PowerPointPresentation
- Open presentation whose slides should be searched.
- -ShapeIndex Int32[]
- Optional zero-based shape index filter, useful when several shapes contain the same text.
- -Text String
- Literal text to find in text boxes and table cells.
- -Pattern String
- Regular expression to find in text boxes and table cells.
- -Slide PowerPointSlide
- Single slide to search when the caller has already resolved the slide.
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.
Outputs
PSWriteOffice.Services.PowerPoint.PowerPointShapeInfo: PowerShell-friendly description of a PowerPoint shape.