mlreportgen.ppt.ColSpec Class
Namespace: mlreportgen.ppt
Formatting for table column
Description
Use an object of the mlreportgen.ppt.ColSpec class to format the
content of a table column in a PPT API presentation. Specify formats by setting the
format properties, adding format objects to the Style property, or
a combination of the two. See Presentation Formatting Approaches.
The mlreportgen.ppt.ColSpec class is a handle class.
Class Attributes
ConstructOnLoad | true |
HandleCompatible | true |
For information on class attributes, see Class Attributes.
Creation
Properties
Table column width, specified as a character vector or string scalar that
contains a number followed by a unit of measurement. For example,
"2in" specifies 2 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.
Example: "2in"
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Whether to use bold for the text, specified as a logical 1
(true) or 0 (false). When you
specify:
1(true) — Render text in bold.0(false) — Render text in regular weight.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: logical
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 of the text, specified as a character vector or string scalar that contains a number followed by a unit of measurement. For example, "11pt"
specifies 11 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
Whether to use italic for the text, specified as a logical 1
(true) or 0 (false). When you
specify:
1(true) — Render text in italic.0(false) — Render text as straight text.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: logical
Strikethrough style for the text, specified as one of these values:
"single"— Single horizontal line"none"—No strikethrough line"double"— Double horizontal line
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Whether to display the text as a subscript, specified as a logical 1
(true) or 0 (false). When you
specify:. If Subscript is 1
(true), text renders as a subscript. If
Subscript is 0 (false),
text renders as regular text.
1(true) — Render text as a subscript.0(false) — Render text in regular text.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: logical
Whether to display the document element as a superscript, specified as a logical 1
(true) or 0 (false). When you
specify:
1(true) — Render document element as a superscript.0(false) — Render document element in regular text.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: logical
Underline style for the text, specified as one of these values:
| Value | Description |
|---|---|
"single" | Single underline |
"double" | Double underline |
"heavy" | Thick underline |
"words" | Only words underlined (not spaces) |
"dotted" | Dotted underline |
"dottedheavy" | Thick, dotted underline |
"dash" | Dashed underline |
"dashheavy" | Thick, dashed underline |
"dashlong" | Long, dashed underline |
"dashlongheavy" | Thick, long, dashed underline |
"dotdash" | Dot-dash underline |
"dotdashheavy" | Thick, dot-dash underline |
"dotdotdash" | Dot-dot-dash underline |
"dotdotdashheavy" | Thick, dot-dot-dash underline |
"wavy" | Wavy underline |
"wavyheavy" | Thick, wavy underline |
"wavydouble" | Wavy, double underline |
"none" | No underline |
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
Horizontal alignment of the content, specified as a character vector or string scalar. Specify one of the values in the table.
| Value | Description |
|---|---|
| Centered |
| Left-justified |
| Right-justified |
| Left and right-justified, spacing words evenly |
| Left and right-justified, spacing letters evenly |
| Left and right-justified Thai text, spacing characters evenly |
| Justification for Arabic text
|
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Vertical alignment of the content, specified as one of these values:
| Value | Description |
|---|---|
| Vertically aligned to the top |
| Vertically aligned to the bottom of the table entry |
| Vertically aligned to the middle of the table entry |
| Vertically aligned to the top and horizontally aligned to the center of the table entry |
| Vertically aligned to the bottom and horizontally aligned to the center of the table entry |
| Vertically aligned to the middle and horizontally aligned to the center of the table entry |
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Orientation of the text, specified as one of these values:
| Value | Description |
|---|---|
"horizontal" | Text orientation is horizontal. |
"down" | Text orientation is vertical, with the content rotated 90 degrees, clockwise. |
"up" | Text orientation is vertical, with the content rotated 90 degrees, counterclockwise. |
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Column formatting, specified as a cell array of PPT API format objects.
Formats that do not apply to a ColSpec 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
Examples
Create a presentation and add a slide.
import mlreportgen.ppt.* ppt = Presentation("myColSpec.pptx"); open(ppt); slide = add(ppt,"Title and Content");
Create a table. Specify the width and background color of the first two columns of the table.
t = Table(magic(12));
t.Style = {HAlign("center")};
colSpecs(2) = ColSpec("2in");
colSpecs(1) = ColSpec("1in");
colSpecs(1).BackgroundColor = "red";
colSpecs(2).BackgroundColor = "green";
t.ColSpecs = colSpecs;
Add the table to the slide.
replace(slide,"Content",t);
Close and view the presentation.
close(ppt); rptview(ppt);

Create a presentation.
import mlreportgen.ppt.* ppt = Presentation("myTextOrientation.pptx"); open(ppt);
Add a slide to the presentation.
slide = add(ppt,"Title and Table");Create a table.
table = Table({"Col 1","Col 2";"entry 1","entry 2"});
table.Height = "2in";
table.Style = [table.Style {VAlign("middleCentered")}];Define the formatting for the table columns by using
mlreportgen.ppt.ColSpec objects. Specify that the
orientation of the text in the first column is vertical, rotated 90 degrees,
counterclockwise. Specify that the orientation of the text in the second
column is vertical, rotated 90 degrees, clockwise.
colSpecs(1) = ColSpec("1in"); colSpecs(1).TextOrientation = "up"; colSpecs(2) = ColSpec("1in"); colSpecs(2).TextOrientation = "down";
Assign the ColSpec objects to the Table
object.
table.ColSpecs = colSpecs;
Add the table to the slide.
replace(slide,"Table",table);Close and view the presentation.
close(ppt); rptview(ppt);

Tips
To create an array of
ColSpecobjects, use a for-loop. See Create an Object Array Using a Loop.
Version History
Introduced in R2015b
See Also
mlreportgen.ppt.ColWidth | mlreportgen.ppt.Bold | mlreportgen.ppt.FontFamily | mlreportgen.ppt.FontColor | mlreportgen.ppt.FontSize | mlreportgen.ppt.Italic | mlreportgen.ppt.Strike | mlreportgen.ppt.Subscript | mlreportgen.ppt.Superscript | mlreportgen.ppt.Underline | mlreportgen.ppt.BackgroundColor | mlreportgen.ppt.HAlign | mlreportgen.ppt.VAlign
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.
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)
