replace
Class: mlreportgen.ppt.TemplateTable
Namespace: mlreportgen.ppt
Replace template table with another table
Syntax
newTable = replace(templateTable,replacementTable)
Description
replaces a template table with another table.newTable
= replace(templateTable
,replacementTable
)
Input Arguments
templateTable
— Template table to replace
mlreportgen.ppt.TemplateTable
object
Template table to replace, specified as an
mlreportgen.ppt.TemplateTable
object.
replacementTable
— Replacement table
mlreportgen.ppt.Table
object
Replacement table, specified as an mlreportgen.ppt.Table
object.
Output Arguments
newTable
— New table
mlreportgen.ppt.Table
object
New table in the presentation slide, specified as an
mlreportgen.ppt.Table
object.
Examples
Replace Template Table
Generate a presentation, MyTablePresentation
, that you then use as the template presentation for another presentation. MyTablePresentation
has one slide with one table
import mlreportgen.ppt.* ppt = Presentation("MyTablePresentation"); open(ppt); slide1 = add(ppt,"Title and Table"); replace(slide1,"Title","Magic Square Slide 1"); replace(slide1,"Table",Table(magic(3)));
Close and view the presentation.
close(ppt); rptview(ppt);
Create a presentation, MyNewTablePresentation
, from MyTablePresentation
. MyTablePresentation
is the template presentation for MyNewTablePresentation
,
ppt = Presentation("MyNewTablePresentation","MyTablePresentation"); open(ppt);
Find the template table by using the find
method of the slide object. Because the table comes from a template presentation slide, find
returns the table as an mlreportgen.ppt.TemplateTable
object.
slide1 = ppt.Children(1);
templateTableObj1 = find(slide1,"Table")
templateTableObj1 = TemplateTable with properties: XMLMarkup: '<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id="3" name="Table"/><p:cNvGraphicFramePr><a:graphicFrameLocks noGrp="1"/></p:cNvGraphicFramePr><p:nvPr><p:ph idx="1" type="tbl"/></p:nvPr></p:nvGraphicFramePr><p:xfrm><a:off x="838200" y="1825625"/><a:ext cx="10515600" cy="4351338"/></p:xfrm><a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table"><a:tbl><a:tblPr bandRow="1" firstRow="1"/><a:tblGrid><a:gridCol w="3505200"/><a:gridCol w="3505200"/><a:gridCol w="3505200"/></a:tblGrid><a:tr h="0"><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>8</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>1</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>6</a:t></a:r></a:p></a:txBody></a:tc></a:tr><a:tr h="0"><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>3</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>5</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>7</a:t></a:r></a:p></a:txBody></a:tc></a:tr><a:tr h="0"><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>4</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>9</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>2</a:t></a:r></a:p></a:txBody></a:tc></a:tr></a:tbl></a:graphicData></a:graphic></p:graphicFrame>' Name: 'Table' X: '838200emu' Y: '1825625emu' Width: '10515600emu' Height: '4351338emu' Style: [] Children: [] Parent: [1×1 mlreportgen.ppt.Slide] Tag: 'ppt.TemplateTable:883:428' Id: '883:428'
Replace the table on the slide with a table for a 4-by-4 magic square.
replace(templateTableObj1,Table(magic(4)));
Close and view the presentation.
close(ppt); rptview(ppt);
Version History
Introduced in R2019b
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 (한국어)