Main Content

mlreportgen.ppt.Slide Class

Namespace: 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 or string scalar.

Attributes:

GetAccess
public
SetAccess
private
NonCopyable
true
Transient
true

Data Types: char | string

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

Attributes:

GetAccess
public
SetAccess
private
NonCopyable
true
Transient
true

Data Types: char | string

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.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

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.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

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

Attributes:

GetAccess
public
SetAccess
private
NonCopyable
true

Object identifier, 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:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

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 document generation.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

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 namespace 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