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.TableRow class

Package: mlreportgen.ppt
Superclasses:

Description

Row to include in a table.

To add content to a table row, append mlreportgen.ppt.TableEntry objects to the 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

tableRowObj = TableRow() creates an empty table row object.

Output Arguments

expand all

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

Properties

expand all

Default formatting for text in table entries in a table row, specified as an array of PPT style objects that specifies the format for the text. You can include these mlreportgen.ppt style objects in the cell array:

  • BackgroundColor object

  • FontFamily object

  • FontSize object

  • Bold object

  • FontColor object

  • Italic object

  • Underline object

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 row.

Examples

expand all

Create a presentation.

import mlreportgen.ppt.*

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

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

Create a table with three columns.

table1 = Table(3);

Create the first table row.

tr1 = TableRow();
tr1.Style = {Bold(true)};

Create three table entries for the first row.

te1tr1 = TableEntry();
p = Paragraph('first entry');
p.FontColor = 'red';
append(te1tr1,p);

te2tr1 = TableEntry();
append(te2tr1,'second entry');

te3tr1 = TableEntry();
te3tr1.Style = {FontColor('green')};
append(te3tr1,'third entry');

Append the table entries to the first row.

append(tr1,te1tr1);
append(tr1,te2tr1);
append(tr1,te3tr1);

Create the second table row.

tr2 = TableRow();

Create three table entries for the second row.

te1tr2 = TableEntry();
te1tr2.Style = {FontColor('red')};
p = Paragraph('first entry');
append(te1tr2,p);

te2tr2 = TableEntry();
append(te2tr2,'second entry');

te3tr2 = TableEntry();
te3tr2.Style = {FontColor('green')};
append(te3tr2,'third entry');

Append the table entries to the second row.

append(tr2,te1tr2);
append(tr2,te2tr2);
append(tr2,te3tr2);

Append the table rows to the table.

append(table1,tr1);
append(table1,tr2);

Use the mlreportgen.ppt.Slide.find method to find objects in the slide with the Name property set to Table. In the default PPT API template, the Title and Table layout slide has an object with the name Table.

contents = find(slide1,'Table');

Replace the table placeholder with table1.

replace(contents(1),table1);

Close the presentation to generate the output.

close(slides);

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

if ispc
    winopen(slidesFile);
end

Introduced in R2015b

Was this topic helpful?