Change Text

This example shows how to use the changeText instruction to replace text in a PowerPoint presentation. The replace parameter specifies a substring to search for globally--in shapes, in notes, in charts, in slide layouts, and in slide masters--and replace with newText.

The shapeName parameter constrains the operation to shapes with a matching name and is used throughout the Slide Tailor API. To view or change PowerPoint shape names, open the Selection Pane from the Home tab of the PowerPoint ribbon, as the following editor screenshot shows.

Screenshot showing shape names in selection pane

Slide Tailor keys on shape names, which you can find and edit from PowerPoint's Selection Pane.

Example changing two strings

Template

QBR template
QBR template

Tailored presentation

QBR filled
qbr-filled.pptx

The shell script below replaces text in two spots in a qbr-template.pptx, by matching a shape name and by matching a substring within the shape text. The slide has a title placeholder inherited from its layout, which has been given a shape name "company name" on this particular slide. The slide also has a text box containing the substring "_QUARTER_" to be replaced while leaving the rest of the shape contents unchanged. There is nothing special about the underscores or capitals; you can replace any substring with or without a naming convention. Since the substring will be replaced globally, you should be careful to avoid replacing substrings that are part of other words.