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

Package: mlreportgen.ppt
Superclasses:

Background color of presentation element

Description

Specifies the background color of these presentation element PPT API objects:

  • TextBox

  • TextBoxPlaceholder

  • ContentPlaceholder

  • TablePlaceholder

  • Table

  • TableRow

  • TableEntry

  • ColSpec

  • TextBox

Construction

backgroundColorObj = BackgroundColor() creates a white background.

backgroundColorObj = BackgroundColor(color) creates a background color object based on the specified CSS color name or hexidecimal RGB color value.

Input Arguments

expand all

Background color, specified as a character vector. You can use:

  • The name of a color, specified as a character vector. The name must be a CSS color name. See http://www.crockford.com/wrrrld/color.html.

  • Hexidecimal RGB (red, green, blue) color value, specified as a character vector. Use the format #RRGGBB. Use # as the first character and two-digit hexidecimal numbers for each the red, green, and blue value. For example, '#0000ff' specifies blue.

Output Arguments

expand all

Background color for a report object, returned as an mlreportgen.ppt.BackgroundColor 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.

The name of a color, specified as a character vector, using one of these values:

  • A CSS color name. See http://www.crockford.com/wrrrld/color.html.

  • An RGB value, using a character vector having the format #RRGGBB. Use # as the first character and two-digit hexidecimal numbers for each the red, green, and blue value. For example, '#0000ff' specifies blue.

Examples

expand all

Create a table with different color rows and table entries.

Set up a presentation with a slide titled A Colorful Table.

import mlreportgen.ppt.*
slidesFile = 'myBackground.pptx';
slides = Presentation(slidesFile);
slide1 = add(slides,'Title and Content');
replace(slide1,'Title','A Colorful Table');

Define the table, specifying different colors for the top row and for the first entry in the second row.

table1 = Table();

row1 = TableRow();
row1.Style = {BackgroundColor('beige')};
row1entry1 = TableEntry();
p2 = Paragraph('Beige row');
append(row1entry1,p2);
row1entry2 = TableEntry();
p3 = Paragraph('More text');
append(row1entry2,p3);
append(row1,row1entry1);
append(row1,row1entry2);

row2 = TableRow();
row2entry1 = TableEntry();
row2entry1.Style = {BackgroundColor('yellow')};
p4 = Paragraph('yellow cell');
append(row2entry1,p4);
row2entry2 = TableEntry();
p5 = Paragraph('default white background');
append(row2entry2,p5);
append(row2,row2entry1);
append(row2,row2entry2);

append(table1,row1);
append(table1,row2);

Replace the slide content with the table, generate the presentation, and open the myBackground presentation. (The winopen code works on Windows® platforms.)

replace(slide1,'Content',table1);
close(slides); 

if ispc
    winopen(slidesFile);
end

Was this topic helpful?