replace
Class: mlreportgen.ppt.TablePlaceholder
Namespace: mlreportgen.ppt
Replace table placeholder with table
Description
replaces the specified table placeholder with the specified table and returns the
table object.replacementTableObj
= replace(tablePlaceholder
,table
)
Examples
Replace Table Placeholder with Table
Add a Title and Table
slide to a presentation and then replace the title and table placeholders with your own title and table.
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("myTablePlaceholderPresentation.pptx");
open(ppt);
Add a slide that has a Title and Table
layout.
slide = add(ppt,"Title and Table");
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: [] Y: [] Width: [] Height: [] Style: [] Children: [] Parent: [1×1 mlreportgen.ppt.Slide] Tag: 'ppt.TextBoxPlaceholder:555:529' Id: '555:529'
The find
method returns an mlreportgen.ppt.TextBoxPlaceholder
object.
Replace the placeholder content with the title text.
replace(titlePlaceholderObj,"Fourth-Order Magic Square");
Use the find
method of the slide object to find the placeholder object that has the name Table
.
tablePlaceholderObj = find(slide,"Table")
tablePlaceholderObj = TablePlaceholder with properties: Bold: [] Font: [] ComplexScriptFont: [] FontColor: [] FontSize: [] Italic: [] Strike: [] Subscript: [] Superscript: [] Underline: [] BackgroundColor: [] VAlign: [] Name: 'Table' X: [] Y: [] Width: [] Height: [] Style: [] Children: [] Parent: [1×1 mlreportgen.ppt.Slide] Tag: 'ppt.TablePlaceholder:556:530' Id: '556:530'
The find
method returns an mlreportgen.ppt.TablePlaceholder
object.
Replace the table placeholder with a table for a fourth-order magic square.
replace(tablePlaceholderObj,Table(magic(4)));
Close and view the presentation
close(ppt); rptview(ppt);
Here is the slide in the generated presentation:
Input Arguments
tablePlaceholder
— Table placeholder
mlreportgen.ppt.TablePlaceholder
object
Table placeholder, specified as an mlreportgen.ppt.TablePlaceholder
object.
table
— Table to use as replacement
mlreportgen.ppt.Table
object
Table to use as the replacement for the table placeholder, specified as an
mlreportgen.ppt.Table
object.
Output Arguments
replacementTableObj
— Replacement table
mlreportgen.ppt.Table
object
Replacement table, returned as an mlreportgen.ppt.Table
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 (한국어)