mlreportgen.ppt.Table class
Package: 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.Table()Table
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
tableValues
— Table values
two-dimensional numeric array | two-dimensional categorical array | two-dimensional cell array
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
NCols
— Number of table columns
0 (default) | integer
Number of table columns, specified as an integer. This property is
read-only. 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 is
updated. 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.
StyleName
— Table style name
[]
(default) | character vector | string scalar
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.
BackgroundColor
— Table background color
[]
(default) | character vector | string scalar
Table background color, specified as a character vector or string scalar that consists of a CSS color name or hexadecimal RGB value.
For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords.
To specify a hexadecimal RGB format, use
#
as the first character and two-digit hexadecimal numbers for the red, green, and blue values. For example,'#0000ff'
specifies blue.
ColSpecs
— Table column format objects
[]
(default) | array of mlreportgen.ppt.ColSpec
objects
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.
FlowDirection
— Table column flow direction
[]
(default) | 'LeftToRight'
| 'RightToLeft'
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.
Border
— Border style
'solid'
(default) | 'none'
| 'dot'
| ...
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'
BorderColor
— Border color
'black'
(default) | character vector | string scalar
Border color, specified as a character vector or string scalar that consists of a CSS color name or hexadecimal RGB value.
For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords.
To specify a hexadecimal RGB format, use
#
as the first character and two-digit hexadecimal numbers for the red, green, and blue values. For example,'#0000ff'
specifies blue.
BorderWidth
— Border width
'1pt'
(default) | character vector | string scalar
Border width, specified as a character vector or string scalar that
consists of a number followed by an abbreviation for a unit of measurement.
For example, '3pt'
specifies three points. Valid
abbreviations are:
px
— pixels (default)cm
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
ColSep
— Column separator style
'solid'
(default) | 'none'
| 'dot'
| ...
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'
ColSepColor
— Column separator color
'black'
(default) | character vector | string scalar
Column separator color, specified as a character vector or string scalar that consists of a CSS color name or hexadecimal RGB value.
For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords.
To specify a hexadecimal RGB format, use
#
as the first character and two-digit hexadecimal numbers for the red, green, and blue values. For example,'#0000ff'
specifies blue.
ColSepWidth
— Column separator width
'1pt'
(default) | character vector | string scalar
Column separator width, specified as a character vector or string scalar
that consists of a number followed by an abbreviation for a unit of
measurement. For example, '3pt'
specifies three points.
Valid abbreviations are:
px
— pixels (default)cm
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
RowSep
— Row separator style
'solid'
(default) | 'none'
| 'dot'
| ...
Row 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'
RowSepColor
— Row separator color
'black'
(default) | character vector | string scalar
Row separator color, specified as a character vector or string scalar that consists of a CSS color name or hexadecimal RGB value.
For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords.
To specify a hexadecimal RGB format, use
#
as the first character and two-digit hexadecimal numbers for the red, green, and blue values. For example,'#0000ff'
specifies blue.
RowSepWidth
— Row separator width
'1pt'
(default) | character vector | string scalar
Row separator width, specified as a character vector or string scalar that
consists of a number followed by an abbreviation for a unit of measurement.
For example, '3pt'
specifies three points. Valid
abbreviations are:
px
— pixels (default)cm
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
Font
— Font family for text in this table
[]
(default) | character vector | string scalar
Font family for the text in this table, 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.
ComplexScriptFont
— Font family for complex scripts
[]
(default) | character vector | string scalar
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, for rendering text.
FontColor
— Font color for text in this table
[]
(default) | character vector | string scalar
Font color for text in this table, specified as a character vector or string scalar that consists of a CSS color name or hexadecimal RGB value.
For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords.
To specify a hexadecimal RGB format, use
#
as the first character and two-digit hexadecimal numbers for the red, green, and blue values. For example,'#0000ff'
specifies blue.
FontSize
— Font size of text in this table
[]
(default) | character vector | string scalar
Font size of text in this table, specified as a character vector or string
scalar that consists of a number followed by a unit of measurement. For
example, '11pt'
specifies 11 points. Valid abbreviations
are:
px
— pixels (default)cm
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
Name
— Table name
''
(default) | character vector | string scalar
Table name, specified as a character vector or string scalar.
X
— Upper left x-coordinate of position of table
[]
(default) | character vector | string scalar
Upper left x-coordinate of the position of the table, specified as a
character vector or string scalar that consists of a number followed by a
unit of measurement. For example, '5in'
specifies 5
inches. Valid abbreviations are:
px
— pixels (default)cm
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
Y
— Upper left y-coordinate of position of table
[]
(default) | character vector | string scalar
Upper left y-coordinate of the position of the table, specified as a
character vector or string scalar that consists of a number followed by a
unit of measurement. For example, '5in'
specifies 5
inches. Valid abbreviations are:
px
— pixels (default)cm
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
Width
— Width of table
[]
(default) | character vector | string scalar
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 (default)cm
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
Height
— Height of table
[]
(default) | character vector | string scalar
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 (default)cm
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
If the table height is specified and the row height is not specified for any row, the height of all rows is the same. The row height is determined by dividing the table height by the number of rows. If the height is specified for at least one row, the PPT API ignores the table height. Microsoft PowerPoint determines the height of the rows for which the height is not specified.
Style
— Table formatting
cell array of PPT format objects
Table formatting, specified as a cell array of PPT format objects. Formats
that do not apply to a Table
object are ignored.
Children
— Children of this PPT API object
cell array of PPT objects
Child elements of this object, specified as a cell array of PPT objects. This property is read-only.
Parent
— Parent of this PPT API object
PPT object
Parent of this object, specified as a PPT object. This property is read-only.
Tag
— Tag for this PPT API object
character vector | string scalar
Tag for this PPT API object, specified as a character vector or string scalar. A
session-unique tag is generated 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.
Specifying your own tag value can help you to identify where an issue occurred during presentation generation.
Id
— ID for this PPT API object
character vector | string scalar
ID for this PPT API object, specified as a character vector or string scalar. A session-unique ID is generated as part of object creation. You can specify an ID to replace the generated ID.
Methods
Public Methods
append | Append row to table |
replace | Replace table with another table |
row | Access table row |
entry | Access table entry |
clone |
Use
the |
Examples
Add a Table to a Presentation
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:
Order Table Columns
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 R2015b
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
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)