Main Content

mlreportgen.ppt.TemplateTable Class

Namespace: mlreportgen.ppt

Table from template presentation slide

Description

Objects of the mlreportgen.ppt.TemplateTable class represent template tables. A template table is a table that comes from a slide in the template presentation. Customize a template table by modifying properties of the associated mlreportgen.ppt.TemplateTable object. Replace a template table with another table by using the replace method of the mlreportgen.ppt.TemplateTable object.

The mlreportgen.ppt.TemplateTable class is a handle class.

Class Attributes

HandleCompatible
true
ConstructOnLoad
true

For information on class attributes, see Class Attributes.

Creation

You do not create an mlreportgen.ppt.TemplateTable object explicitly. When you create a presentation from an existing presentation, the MATLAB® API for PowerPoint® (PPT API) creates an mlreportgen.ppt.TemplateTable object for each table that comes from a slide in the template presentation.

You can access the mlreportgen.ppt.TemplateTable object for a template table by using:

Note

Tables that you add to a new presentation are represented as mlreportgen.ppt.Table objects.

Properties

expand all

XML markup of template table, specified as a character vector or string scalar. You can modify the template table by changing the XML markup. Modify the XML markup for customizations for which there is no property. The updated markup is written to the generated presentation. If you update other properties, such as X, Y, Width, or Height, the corresponding attributes in the XML markup are updated before the markup is written to the generated presentation.

Attributes:

NonCopyable
true

Data Types: char | string

Table name, specified as a character vector or string scalar.

Attributes:

NonCopyable
true

Data Types: char | string

Upper-left x-coordinate position, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "5in" specifies five inches. Valid abbreviations are:

  • "px" — pixels

  • "cm" — centimeters

  • "in" — inches

  • "mm" — millimeters

  • "pc" — picas

  • "pt" — points

Note

When the PPT API creates an mlreportgen.ppt.TemplateTable object, this property value is specified in English Metric Units (EMU). If you set this property, you must use one of the units in the previous list.

Attributes:

NonCopyable
true

Data Types: char | string

Upper-left y-coordinate position, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "5in" specifies five inches. Valid abbreviations are:

  • "px" — pixels

  • "cm" — centimeters

  • "in" — inches

  • "mm" — millimeters

  • "pc" — picas

  • "pt" — points

Note

When the PPT API creates an mlreportgen.ppt.TemplateTable object, this property value is specified in English Metric Units (EMU). If you set this property, you must use one of the units in the previous list.

Attributes:

NonCopyable
true

Data Types: char | string

Width of table, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, '5in' specifies five inches. Valid abbreviations are:

  • "px" — pixels

  • "cm" — centimeters

  • "in" — inches

  • "mm" — millimeters

  • "pc" — picas

  • "pt" — points

Note

When the PPT API creates an mlreportgen.ppt.TemplateTable object, this property value is specified in English Metric Units (EMU). If you set this property, you must use one of the units in the previous list.

Data Types: char | string

Height of table, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, '5in' specifies five inches. Valid abbreviations are:

  • "px" — pixels

  • "cm" — centimeters

  • "in" — inches

  • "mm" — millimeters

  • "pc" — picas

  • "pt" — points

Note

When the PPT API creates an mlreportgen.ppt.TemplateTable object, this property value is specified in English Metric Units (EMU). If you set this property, you must use one of the units in the previous list.

Data Types: char | string

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

SetAccess
private
NonCopyable
true

Parent of this object, specified as a PPT API object. A PPT API object must only have one parent.

Attributes:

SetAccess
private
NonCopyable
true

Object identifier for the mlreportgen.ppt.TemplateTable object, specified as a character vector or string scalar. The PPT API generates a session-unique identifier when it creates the document element object. You can specify your own value for Id.

Attributes:

NonCopyable
true

Data Types: char | string

Tag for the mlreportgen.ppt.TemplateTable object, specified as a character vector or string scalar. The PPT API generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object. Specify your own tag value to help you identify where to look when an issue occurs during document generation.

Attributes:

NonCopyable
true

Data Types: char | string

Methods

expand all

Examples

collapse all

Generate a presentation, MyTablePresentation, that you then use as the template presentation for another presentation. MyTablePresentation has two slides, and each slide has 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)));

slide2 = add(ppt,"Title and Table");
replace(slide2,"Title","Magic Square Slide 2");
replace(slide2,"Table",Table(magic(5)));

Close and view MyTablePresentation.

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 tables by using the find method of the slide objects. Because the tables come from the template presentation, find returns the tables as mlreportgen.ppt.TemplateTable objects.

slide1 = ppt.Children(1);
slide2 = ppt.Children(2);
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:1234:488'
           Id: '1234:488'

templateTableObj2 = find(slide2,"Table")
templateTableObj2 = 
  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="2103120"/><a:gridCol w="2103120"/><a:gridCol w="2103120"/><a:gridCol w="2103120"/><a:gridCol w="2103120"/></a:tblGrid><a:tr h="0"><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>17</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>24</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>8</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>15</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>23</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:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>14</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>16</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>6</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>13</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>20</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>22</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>10</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>12</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>19</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>21</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>3</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>11</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>18</a:t></a:r></a:p></a:txBody></a:tc><a:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>25</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:tc><a:txBody><a:bodyPr/><a:p><a:r><a:t>9</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:1238:490'
           Id: '1238:490'

Change the position of the table on the first slide.

templateTableObj1.X = "1in";
templateTableObj1.Y = "3in";

Replace the table on the second slide with a table for a 4-by-4 magic square.

replace(templateTableObj2,Table(magic(4)));

Close and view MyNewTablePresentation.

close(ppt);
rptview(ppt);

Version History

Introduced in R2019b