replace
Class: mlreportgen.ppt.TextBoxPlaceholder
Namespace: mlreportgen.ppt
Replace text box placeholder content
Description
replaces the content in the specified text box placeholder with a paragraph and
returns the paragraph object.replacementParagraphObj
= replace(textBoxPlaceholder
,paragraph
)
Examples
Replace Title Text in Placeholder
Add a title slide to a presentation and then replace the slide placeholders for the title and subtitle with your title and subtitle text.
Import the PPT namespace so that you do not have to use long, fully qualified names for the PPT API classes.
import mlreportgen.ppt.*
Create a presentation.
ppt = Presentation("myTextBoxPlaceholderPresentation.pptx");
open(ppt);
Add a title slide.
slide = add(ppt,"Title Slide");
Use the find
method of the slide object to find the placeholder object that has the name Title
.
titlePlaceholderObj = find(slide,"Title")
titlePlaceholderObj = TextBoxPlaceholder with properties: Bold: [] Font: [] ComplexScriptFont: [] FontColor: [] FontSize: [] Italic: [] Strike: [] Subscript: [] Superscript: [] Underline: [] BackgroundColor: [] VAlign: [] Name: 'Title' X: '1524000emu' Y: '1122363emu' Width: '9144000emu' Height: '2387600emu' Style: [] Children: [] Parent: [1×1 mlreportgen.ppt.Slide] Tag: 'ppt.TextBoxPlaceholder:431:407' Id: '431:407'
The find
method returns an mlreportgen.ppt.TextBoxPlaceholder
object.
Replace the placeholder content with the title text.
replace(titlePlaceholderObj(1),"My Title");
Find the placeholder object for the subtitle.
subtitlePlaceholderObj = find(slide,"Subtitle")
subtitlePlaceholderObj = TextBoxPlaceholder with properties: Bold: [] Font: [] ComplexScriptFont: [] FontColor: [] FontSize: [] Italic: [] Strike: [] Subscript: [] Superscript: [] Underline: [] BackgroundColor: [] VAlign: [] Name: 'Subtitle' X: '1524000emu' Y: '3602038emu' Width: '9144000emu' Height: '1655762emu' Style: [] Children: [] Parent: [1×1 mlreportgen.ppt.Slide] Tag: 'ppt.TextBoxPlaceholder:432:408' Id: '432:408'
The placeholder object for the subtitle is also an mlreportgen.ppt.TextBoxPlaceholder
object.
Replace the placeholder content with the text for the subtitle.
replace(subtitlePlaceholderObj(1),"My Subtitle");
Close and view the presentation.
close(ppt); rptview(ppt);
Here is the title slide in the generated presentation:
Input Arguments
textBoxPlaceholder
— Text box placeholder
mlreportgen.ppt.TextBoxPlaceholder
object
Text box placeholder, specified as an mlreportgen.ppt.TextBoxPlaceholder
object.
paragraph
— Paragraph to use as replacement
character vector | string scalar | mlreportgen.ppt.Paragraph
object
Paragraph to use as the replacement for the text box placeholder content,
specified as a character vector, string scalar, or mlreportgen.ppt.Paragraph
object.
Output Arguments
replacementParagraphObj
— Replacement paragraph
mlreportgen.ppt.Paragraph
object
Replacement paragraph, returned as an mlreportgen.ppt.Paragraph
object.
Version History
Introduced in R2015b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)