mlreportgen.ppt.Table Class
Namespace: mlreportgen.ppt
Table in presentation
Description
Use an object of the mlreportgen.ppt.Table class to include a table in
a PPT API presentation.
Create a table using one of these approaches:
Create an empty table and append table rows that have table entries for each column.
Create a table from an array or cell array that specifies the table content.
After you create a table, you can add rows to the table, and add entries to each table row.
The mlreportgen.ppt.Table class is a handle class.
Class Attributes
HandleCompatible | true |
ConstructOnLoad | true |
For information on class attributes, see Class Attributes.
Creation
Description
creates an empty tableObj = mlreportgen.ppt.TableTable object.
sets the NCols property to
tableObj = mlreportgen.ppt.Table(nCols)nCols.
returns a table that has the content specified by
tableObj = mlreportgen.ppt.Table(tableValues)tableValues.
returns a table that has the specified content and sets the StyleName property
to tableObj = mlreportgen.ppt.Table(tableValues,styleName)styleName. To get the list of valid style names, use the
getTableStyleNames method of
the mlreportgen.ppt.Presentation object.
Input Arguments
Table values, specified as a two-dimensional numeric array,
categorical array, or cell array of numbers, character vectors, string
scalars, or mlreportgen.ppt.Paragraph objects.
Properties
Number of table columns, specified as an integer. To specify the number of columns, create a
table by using the syntax mlreportgen.ppt.Table(nCols).
Otherwise, the Table constructor determines the number of columns from
the table content. If you add rows to a table or entries to a row and the number of
columns changes, the NCols property value updates. If the rows do
not all have the same number of entries, the row with the largest number of table
entries determines the number of columns in the table.
Attributes:
GetAccess | public |
SetAccess | private |
NonCopyable | true |
Data Types: uint64
Table style name, specified as a character vector or string scalar. To get
the list of valid style names, use the getTableStyleNames method
of the mlreportgen.ppt.Presentation object.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Background color, specified as a character vector or string scalar that contains a CSS color name or hexadecimal RGB value.
| Format | Value |
|---|---|
| CSS color name | Specify a CSS color name. For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords. |
| Hexadecimal RGB value | Use the format "#RRGGBB". Use # as the first character and two-digit hexadecimal numbers for the red, green, and blue values. You can use uppercase or lowercase letters. |
Setting the BackgroundColor property adds a
mlreportgen.ppt.BackgroundColor format object to the
Style property. Setting the BackgroundColor
property to an empty value removes the object.
Example: "red" specifies a red color using a CSS color name.
Example: "#0000ff" specifies a blue color using a hexadecimal RGB value.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Table column format objects, specified as an array of mlreportgen.ppt.ColSpec
objects that specify the width, alignment, and other formatting properties
of the table columns. The first object applies to the first column, the
second object applies to the second column, and so on. If the number of
ColSpec objects is greater than the number of columns,
ColSpecs ignores the extra ColSpec
objects when formatting the table.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Table column flow direction, specified as a character vector or string scalar. Specify one of these values:
"LeftToRight"— Left-to-right column order"RightToLeft"— Right-to-left column order
See Order Table Columns.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Border style, specified as a character vector or string scalar. Specify one of these values:
"none""solid""dot""dash""largeDash""dashDot""largeDashDot""largeDashDotDot""systemDash""systemDot""systemDashDot""systemDashDotDot"
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Border color, specified as a character vector or string scalar that contains a CSS color name or hexadecimal RGB value.
| Format | Value |
|---|---|
| CSS color name | Specify a CSS color name. For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords. |
| Hexadecimal RGB value | Use the format "#RRGGBB". Use # as the first character and two-digit hexadecimal numbers for the red, green, and blue values. You can use uppercase or lowercase letters. |
Example: "red" specifies a red color using a CSS color
name.
Example: "#0000ff" specifies a blue color using a
hexadecimal RGB value.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Border width, specified as a character vector or string scalar that contains
a number followed by an abbreviation for a unit of measurement. For example, "3pt" specifies three points.
Valid abbreviations are:
"px"— Pixels"cm"— Centimeters"in"— Inches"mm"— Millimeters"pc"— Picas"pt"— Points
You can also specify pixels by omitting the unit. For example, "5"
specifies 5 pixels.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Column separator style, specified as a character vector or string scalar. Specify one of these values:
"none""solid""dot""dash""largeDash""dashDot""largeDashDot""largeDashDotDot""systemDash""systemDot""systemDashDot""systemDashDotDot"
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Document element color, specified as a character vector or string scalar that contains a CSS color name or hexadecimal RGB value.
| Format | Value |
|---|---|
| CSS color name | Specify a CSS color name. For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords. |
| Hexadecimal RGB value | Use the format "#RRGGBB". Use # as the first character and two-digit hexadecimal numbers for the red, green, and blue values. You can use uppercase or lowercase letters. |
Setting the Color property adds a corresponding
mlreportgen.dom.Color format object to the
Style property. Setting the Color
property to an empty value removes the object.
Example: "red" specifies a red color using a CSS color name.
Example: "#0000ff" specifies a blue color using a hexadecimal RGB value.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Column separator width, specified as a character vector or string scalar that contains a number followed by an abbreviation for a unit of measurement. Valid abbreviations are:
"px"— Pixels"cm"— Centimeters"in"— Inches"mm"— Millimeters"pc"— Picas"pt"— Points
You can also specify pixels by omitting the unit. For example, "5"
specifies 5 pixels.
Example: "1pt"
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Row separator style, specified as a character vector or string scalar. Valid values are:
"none""solid""dot""dash""largeDash""dashDot""largeDashDot""largeDashDotDot""systemDash""systemDot""systemDashDot""systemDashDotDot"
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Color of lines separating table rows, specified as a character vector or string scalar that contains a CSS color name or hexadecimal RGB value.
| Format | Value |
|---|---|
| CSS color name | Specify a CSS color name. For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords. |
| Hexadecimal RGB value | Use the format "#RRGGBB". Use # as the first character and two-digit hexadecimal numbers for the red, green, and blue values. You can use uppercase or lowercase letters. |
Example: "red" specifies a red color using a CSS color name.
Example: "#0000ff" specifies a blue color using a hexadecimal RGB value.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Width of the row separator, specified as a character vector or string scalar that contains
a number followed by an abbreviation for a unit of measurement. For example, "10px" specifies 10 pixels.
Valid abbreviations are:
"px"— Pixels"cm"— Centimeters"in"— Inches"mm"— Millimeters"pc"— Picas"pt"— Points
You can also specify pixels by omitting the unit. For example, "5"
specifies 5 pixels.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Since R2026a
Inner margin of table entries, specified as a character vector or string scalar that contains
a number followed by an abbreviation for a unit of measurement. The inner margin is the distance between the content and the
bounding box. For example, "10px" specifies 10 pixels.
Valid abbreviations are:
"px"— Pixels"cm"— Centimeters"in"— Inches"mm"— Millimeters"pc"— Picas"pt"— Points
You can also specify pixels by omitting the unit. For example, "5"
specifies 5 pixels.
Example: "10px"
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Since R2026a
Table entry formatting, specified as a cell array of PPT format objects.
Formats that do not apply to a TableEntry object are
ignored.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: cell
Font family for the text, specified as a character vector or string scalar. Specify a font that appears in the font list in Microsoft® PowerPoint®. To see the font list, in PowerPoint, on the Home tab, in the Font group, click the arrow to the right of the font.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Font family for complex scripts, specified as a character vector or string scalar. Specify a font family to use when substituting in a locale that requires a complex script, such as Arabic or Asian, to render text.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Font color for the text, specified as a character vector or string scalar that contains a CSS color name or hexadecimal RGB value.
| Format | Value |
|---|---|
| CSS color name | Specify a CSS color name. For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords. |
| Hexadecimal RGB value | Use the format "#RRGGBB". Use # as the first character and two-digit hexadecimal numbers for the red, green, and blue values. You can use uppercase or lowercase letters. |
Example: "red" specifies a red color using a CSS color name.
Example: "#0000ff" specifies a blue color using a hexadecimal RGB value.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Font size for document element specified as a character vector or string scalar that contains
a number followed by an abbreviation for a unit of measurement. For example, "12pt" specifies twelve points. Valid
abbreviations are:
"px"— Pixels"cm"— Centimeters"in"— Inches"mm"— Millimeters"pc"— Picas"pt"— Points
Setting the FontSize property adds a corresponding
mlreportgen.dom.FontSize format object to the
Style property. Setting the FontSize property
to an empty value removes the object.
Example: "12pt"
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Table name, specified as a character vector or string scalar.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Upper-left x-coordinate position, specified as a character vector or string scalar that contains
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
You can also specify pixels by omitting the unit. For example, "5"
specifies 5 pixels.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Upper-left y-coordinate position, specified as a character vector or string scalar that contains
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
You can also specify pixels by omitting the unit. For example, "5"
specifies 5 pixels.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Width of table, specified as a
character vector or string scalar that contains 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
You can also specify pixels by omitting the unit. For example, "5"
specifies 5 pixels.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Height of table, specified as a
character vector or string scalar that contains 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
You can also specify pixels by omitting the unit. For example, "5"
specifies 5 pixels.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Table formatting, specified as a cell array of PPT format objects. Formats
that do not apply to a Table object are ignored.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: cell
Parent of this object, specified as a PPT API object. A PPT API object must only have one parent.
Attributes:
GetAccess | public |
SetAccess | private |
NonCopyable | true |
Child elements of this object, specified as a cell array of PPT API objects.
Attributes:
GetAccess | public |
SetAccess | private |
NonCopyable | true |
Data Types: cell
Tag, 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. Use this value to help identify
where an issue occurs during presentation generation.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Object identifier, specified as a character vector or string scalar. The PPT API
generates a session-unique identifier when it creates the presentation element object.
You can specify your own value for Id.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Methods
append | Append row to table |
row | Access table row |
entry | Access table entry |
|
Input Arguments
Return Values
For more information, see the method for the
Example: Replace Table with Another Table |
clone |
Input Arguments
Return Values
For more information, see the method for the
|
Examples
Use mlreportgen.ppt.Table objects to include tables in a presentation.
Create a presentation.
import mlreportgen.ppt.* ppt = Presentation('myTablePresentation.pptx'); open(ppt); slide1 = add(ppt,'Title and Table'); slide2 = add(ppt,'Title and Table');
Create a table from a cell array.
table1 = Table({'a','b';'c','d'});
table1.Children(1).FontColor = 'red';
table1.Children(2).FontColor = 'green';Use the find method to find the slides that have objects with a Name property set to Table. The default PPT API Title and Table layout slide has a Table object.
contents = find(ppt,'Table');Replace the contents of the first slide with table1.
replace(contents(1),table1);
Create a second table from the output of the MATLAB® magic function.
table2 = Table(magic(9));
Replace the contents of the second slide with table2.
replace(contents(2),table2);
Close and view the presentation.
close(ppt); rptview(ppt);
Here are the slides in the generated presentation:

Create a presentation.
import mlreportgen.ppt.* ppt = Presentation("myTableReplacePresentation.pptx"); open(ppt); slide1 = add(ppt,"Blank");
Create an mlreportgen.ppt.Table object.
t1 = Table(magic(7)); t1.X = "2in"; t1.Y = "2in"; t1.Width = "6in"; t1.Height = "4in";
Search in slide1 for Table.
add(slide1,t1);
Create another mlreportgen.ppt.Table object.
t2 = Table(magic(9)); t2.X = "2in"; t2.Y = "2in"; t2.Width = "7in"; t2.Height = "5in";
Replace t1 with t2.
replace(t1,t2);
Generate the presentation. Open
myTableReplacePresentation.pptx. On a Windows® platform, you can open the presentation in MATLAB®:
close(ppt); rptview(ppt);
To specify the order of the columns of a table in a presentation, use the FlowDirection property of the Table object.
Create a presentation.
import mlreportgen.ppt.* ppt = Presentation('myFlowDirection.pptx'); open(ppt);
Add a slide to a presentation.
slide = add(ppt,'Title and Content');Create a table and specify the table flow direction.
t = Table({'entry(1,1)','entry(1,2)';'entry(2,1)','entry(2,2)'});
t.FlowDirection = 'RightToLeft';Add the slide to the table.
replace(slide,'Content',t);Close and view the presentation.
close(ppt); rptview(ppt);
Here is the slide in the generated presentation:

Version History
Introduced in R2015bUse the TableEntriesInnerMargin and
TableEntriesStyle properties to specify the inner margin
between the content and the bounds of a table entry.
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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)