Main Content

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

Description

colSpecObj = mlreportgen.ppt.ColSpec creates an empty table column specification object.

colSpecObj = mlreportgen.ppt.ColSpec(colWidth) sets the Width property to colWidth.

example

Properties

expand all

Table column width, specified as a character vector or string scalar that consists of 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

Option to use bold for column text, specified as a numeric or logical 1 (true) or 0 (false). To make text bold, set this property to true or 1.

Font family for the column 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.

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.

Font color of the column text, specified as a character vector or string scalar, formatted as a CSS color name or a hexadecimal RGB value.

Font size of the column text, 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

  • "cm" — centimeters

  • "in" — inches

  • "mm" — millimeters

  • "pc" — picas

  • "pt" — points

Option to use italic for column text, specified as a numeric or logical 1 (true) or 0 (false). If Italic is true or 1, text renders in italic. If Italic is false or 0, text renders as roman (straight).

Strikethrough style of the column text, specified as a character vector or string scalar. Specify one of these values:

  • 'single' — Single horizontal line

  • 'none' — No strikethrough line

  • 'double' — Double horizontal line

Option to render column text as a subscript, specified as a numeric or logical 1 (true) or 0 (false). If Subscript is true or 1, text renders as a subscript. If Subscript is false or 0, text renders as regular text.

Option to render column text as a superscript, specified as a numeric or logical 1 (true) or 0 (false). If Superscript is true or 1, text renders as a superscript. If Superscript is false or 0, text renders as regular text.

Underline style for column text, specified as a character vector or string scalar. Specify one of the values in the table.

ValueDescription
'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

Background color, specified as a character vector or string scalar, formatted as a CSS color name or a hexadecimal RGB value.

Horizontal alignment of the content in table entries of the column, specified as a character vector or string scalar. Specify one of the values in the table.

ValueDescription

'center'

Centered

'left'

Left-justified

'right'

Right-justified

'justified'

Left and right-justified, spacing words evenly

'distributed'

Left and right-justified, spacing letters evenly

'thaiDistributed'

Left and right-justified Thai text, spacing characters evenly

'justifiedLow'

Justification for Arabic text

Arabic text, justified on the left and justified low on the right

Vertical alignment of the content in table entries of the column, specified as a character vector or string scalar. Specify one of the values in the table.

ValueDescription

'top'

Vertically aligned to the top

'bottom'

Vertically aligned to the bottom of the table entry

'middle'

Vertically aligned to the middle of the table entry

'topCentered'

Vertically aligned to the top and horizontally aligned to the center of the table entry

'bottomCentered'

Vertically aligned to the bottom and horizontally aligned to the center of the table entry

'middleCentered'

Vertically aligned to the middle and horizontally aligned to the center of the table entry

Orientation of the column text, specified as a character vector or string scalar. Specify one of the values in the table.

ValueDescription
'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.

See Specify Orientation of Column Text.

Column formatting, specified as a cell array of PPT API format objects. Formats that do not apply to a ColSpec object are ignored.

Child elements of mlreportgen.ppt.ColSpec object, specified as a cell array of PPT API objects.

Attributes:

NonCopyable
true

Parent of this object, specified as a PPT API object. A PPT API object must only have one parent.

Attributes:

SetAccess
private
NonCopyable
true

Tag for the mlreportgen.ppt.ColSpec object, 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. Specify your own tag value to help you identify where to look when an issue occurs during document generation.

Attributes:

NonCopyable
true

Data Types: char | string

Object identifier for the mlreportgen.ppt.ColSpec object, specified as a character vector or string scalar. The PPT API generates a session-unique identifier when it creates the document element object. You can specify your own value for Id.

Attributes:

NonCopyable
true

Data Types: char | string

Examples

collapse all

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);

Table for presentation. First column is red, second column is green, and subsequent columns have no background color.

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);

Presentation with table showing text in the first column as vertical, rotated 90 degrees, counterclockwise. The orientation of the text in the second column is vertical, rotated 90 degrees, clockwise

Version History

Introduced in R2015b