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

Package: mlreportgen.ppt
Superclasses:

Formatting for table column

Description

Formatting for a table column.

Construction

colSpecObj = ColSpec() creates an empty table column specification.

colSpecObj = ColSpec(colWidth) creates a column specification having the specified width.

Input Arguments

expand all

Width of column, specified in the form valueUnits, where Units is an abbreviation for the width units. These abbreviations are valid:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Output Arguments

expand all

Table column formatting, returned as an mlreportgen.ppt.ColSpec object.

Properties

expand all

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.

Width of table column, specified in the form valueUnits where Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Option to use bold for text, specified as a logical. To make text bold, set this property to true or 1. Setting the Bold property adds a corresponding mlreportgen.ppt.Bold format object to the Style property of this presentation element. Removing the Bold property setting removes the object.

Data Types: logical

Default font for text in column, specified as a character vector. Specify a font that appears in the PowerPoint® list of fonts in the Home tab Font area.

Font family for complex scripts, specified as a character vector. Specify a font family for substituting in a locale that requires a complex script (such as Arabic or Asian) for rendering text.

Font color, specified as a character vector. Use either a CSS color name or a hexadecimal RGB value.

  • For a list of CSS color names, see http://www.crockford.com/wrrrld/color.html.

  • To specify a hexadecimal RGB format, use # as the first character and two-digit hexadecimal numbers for each for the red, green, and blue values. For example, '#0000ff' specifies blue.

Font size, specified as a character vector. Use the format valueUnits, where Units is an abbreviation for the font size. These abbreviations are valid:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Option to use italics for text, specified as a logical. Set this property to true. Setting the Italic property adds a corresponding mlreportgen.ppt.Italic format object to the Style property of this presentation element. Removing the Italic property setting removes the object.

Data Types: logical

Examples

expand all

Create a presentation and add a slide.

import mlreportgen.ppt.*
slides = Presentation('myColSpec.pptx');
tableSlide = add(slides,'Title and Content');

Create a table. Create a ColSpec object with a specified width for the first two columns of the table. Specify the BackgroundColor property for the two ColSpec objects. Set the ColSpecs property of the Table object t to the colSpecs, which specifies the formatting for the first two columns.

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, generate the presentation, and open the myColSpec presentation. (The winopen code works on Windows® platforms.)

replace(slides,'Content',t);
close(slides);

if ispc
    winopen(slidesFile);
end

Was this topic helpful?