Main Content

add

Class: mlreportgen.ppt.Slide
Package: mlreportgen.ppt

Add text box, table, or picture to slide

Description

example

addedObj = add(slide,object) adds the specified mlreportgen.ppt.TextBox, mlreportgen.ppt.Table, or mlreportgen.ppt.Picture object to a slide.

Examples

expand all

Use the add method of an mlreportgen.ppt.Presentation object to add a slide to a presentation. Then, use the add method of the resulting mlreportgen.ppt.Slide object to add a picture to the slide.

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 a presentation and add a slide to it. This example adds a slide with a Blank layout.

ppt = Presentation('mySlideAddPresentation.pptx');
slide = add(ppt,'Blank');

Create an mlreportgen.ppt.Picture object for the picture that you want to add to the slide. Use the Picture object properties to specify the size of the picture in the slide.

plane = Picture('b747.jpg');
plane.X = '4in';
plane.Y = '4in';
plane.Width = '5in';
plane.Height = '2in';

Add the Picture object to the slide.

add(slide,plane);

Close and view the presentation.

close(ppt);
rptview(ppt);

Here is the generated presentation:

Input Arguments

expand all

Slide to add content to, specified as an mlreportgen.ppt.Slide object.

Object to add to a slide, specified as one of these PPT API objects:

Output Arguments

expand all

Object added to slide, returned as one of these PPT API objects:

Introduced in R2015b