Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mlreportgen.ppt.Table class

Package: mlreportgen.ppt
Superclasses:

Description

Table to include in a presentation.

Create a table using one of these approaches:

  • Create an empty table and append table rows, with table entries for each column.

  • Create a table, using an array or cell array to specify the table content.

After you create a table, you can add rows to it, and add entries to each table row. The row with the largest number of table entries determines the number of columns in the table if there are more table entries in the row than the number of rows specified in the mlreportgen.ppt.Table object constructor.

Construction

tableObj = Table() creates an empty table object.

tableObj = Table(nCols) creates an empty table object with the number of columns you specify.

tableObj = Table(tableValues) returns a table whose content is specified by a two-dimensional numeric array or a two-dimensional cell array of numbers, character vectors, or mlreportgen.ppt.Paragraph objects.

Input Arguments

expand all

Number of table columns, specified as a double.

Data Types: double

Table values, specified as one of these:

  • Two-dimensional numeric array

  • Two-dimensional cell array of character vectors, numbers, or mlreportgen.ppt.Paragraph objects, or a combination of these kinds of values

Output Arguments

expand all

Table, returned as an mlreportgen.ppt.Table object.

Properties

expand all

Number of table columns, specified as a double.

Data Types: double

Table name, specified as a character vector.

Table style name from the template for the presentation, specified as a character vector.

Upper-left x-coordinate position of table, specified in the form valueUnits where Units is an abbreviation for the x-position units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Upper-left y-coordinate position of table, specified in the form valueUnits where Units is an abbreviation for the x-position units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Width of table, specified in the form valueUnits where Units is an abbreviation for the x-position units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Height of table, specified in the form valueUnits where Units is an abbreviation for the x-position units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Specifying a table height causes the table rows to have equally-spaced heights whose sum is the specified table height. If the contents of a row do not fit in its row height, that row height expands. This increased row height may cause the table to exceed its specified table height when the table is rendered.

Table formatting. This property is ignored.

This read-only property lists child elements that the object contains, specified as a cell array.

This read-only property lists the parent of this object, specified a PPT object.

ID for PPT API object, specified as a character vector. A session-unique ID is generated as part of object creation. You can specify an ID to replace the generated ID.

Tag for this PPT API object, specified as a character vector. 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.

An example of a reason for specifying your own tag value is to make it easier to identify where an issue occurred during presentation generation.

Methods

Method

Purpose

append

Add content to table.

replace

Replace table.

mlreportgen.ppt.Table.row

Access table row.

mlreportgen.ppt.Table.entry

Access table entry.

Examples

expand all

Create a presentation.

import mlreportgen.ppt.*

slidesFile = 'myTablePresentation.pptx';
slides = Presentation(slidesFile);

slide1 = add(slides,'Title and Table');
slide2 = add(slides,'Title and Table');

Create a table using a cell array.

table1 = Table({'a','b';'c','d'});
table1.Children(1).Style = {FontColor('red')};
table1.Children(2).Style = {FontColor('green')};

Use the mlreportgen.ppt.Presentation.find method to find the slides that have objects with a Name property set to Table. In the default PPT API, the Title and Table layout slide has a Table object.

contents = find(slides,'Table');

Replace the contents of the second slide with table1.

replace(contents(1),table1);

Create a second table using the MATLAB® magic function.

table2 = Table(magic(9));

Replace the table in the third slide with table2.

replace(contents(2),table2);

Close the presentation to generate the output.

close(slides);

Open myTablePresentation.pptx. On a Windows® platform, you can open the presentation in MATLAB:

if ispc
    winopen(slidesFile);
end

Introduced in R2015b

Was this topic helpful?