Main Content

mlreportgen.ppt.Slide class

Package: mlreportgen.ppt

Presentation slide

Description

An object of the mlreportgen.ppt.Slide class represents a slide in a Microsoft® PowerPoint® presentation. To create a Slide object and add it to a presentation, use the add method of an mlreportgen.ppt.Presentation object. The add method returns the Slide object. You can use the Slide object methods to add, find, and replace slide content.

The mlreportgen.ppt.Slide class is a handle class.

Class Attributes

Abstract
true
ConstructOnLoad
true
HandleCompatible
true

For information on class attributes, see Class Attributes.

Properties

expand all

Slide layout name, specified as a character vector. This property is read-only.

Slide master name, specified as a character vector. This property is read-only.

Slide name, specified as a character vector or string scalar. You can set the Name property to identify a slide in a presentation. See the find method of the mlreportgen.ppt.Presentation class.

Slide formatting, specified as a cell array of PPT format objects.

Add format objects by concatenating the existing value of the Style property with a cell array that contains the format objects that you are adding. For example:

import mlreportgen.ppt.*
ppt = Presentation('MyPresentation');
open(ppt);
slide = add(ppt,'Title Only');
slide.Style = [slide.Style {Bold(true),FontColor('red')}];
replace(slide,'Title','My Title is Bold and Red');
close(ppt);
rptview(ppt);

See Presentation Formatting Approaches.

Child elements of this slide, specified as a cell array of PPT objects. This property is read-only.

Parent of this slide, specified as a PPT object. This property is read-only.

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.

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.

Methods

expand all

Examples

collapse all

To add a slide to a presentation, use the add method of the mlreportgen.ppt.Presentation object. The add method returns an mlreportgen.ppt.Slide object. Use the replace method of the Slide object to replace content placeholders with your content.

Import the PPT package so that you do not have to use long, fully qualified names for the PPT API classes.

import mlreportgen.ppt.*

Create and open a presentation.

ppt = Presentation("myPresentation.pptx");
open(ppt);

Add a slide that has a Title and Table layout.

slide = add(ppt,"Title and Table");

Replace the Title placeholder in the slide with the title text.

replace(slide,"Title","magic(4)");

Replace the Table placeholder in the slide with a table.

tbl = Table(magic(4));
replace(slide,"Table",tbl);

Close and view the presentation.

close(ppt);
rptview(ppt);

Here is the generated presentation:

Version History

Introduced in R2015a