This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

mlreportgen.ppt.Presentation class

Package: mlreportgen.ppt

Create Microsoft PowerPoint presentation


Creates a Microsoft® PowerPoint® presentation.


presentationObj = Presentation() creates a presentation named Untitled.pptx in the current folder, using the default PPT API default.pptx template.

presentationObj = Presentation(presentationPath) creates a presentation at the specified location.

presentationObj = Presentation(presentationPath,templatePath) creates a presentation using the PowerPoint template at the specified location.

The type of file created by using this syntax depends on the extensions used by the both arguments. The table shows the supported combinations. The extensions correlate with these file types:

  • .pptx — PowerPoint Presentation

  • .pptm — PowerPoint Macro-Enabled Presentation

  • .potx — PowerPoint Template

  • .potm — PowerPoint Macro-Enabled Template

  • .ppsx — PowerPoint Slide Show

  • .ppsm — PowerPoint Macro-Enabled Slide Show

presentationPath extensiontemplatePath extensionOutput extension

These extensions are not supported for either input argument:

  • .ppt — PowerPoint 97–2003 Presentation

  • .pot — PowerPoint 97–2003 Template

  • .pps — PowerPoint 97–2003 Slide Show

  • .xml — PowerPoint XML Presentation

Input Arguments

expand all

Path to the presentation file, specified as a character vector.

Path to the PowerPoint template for the presentation, specified as a character vector.

Output Arguments

expand all

Presentation object, returned as an mlreportgen.ppt.Presentation object


expand all

The path to the PowerPoint template to use for this presentation element, specified as a character vector.

You set this property only before you open the presentation.

Path of this output file of the presentation, specified as a character vector.

This read-only property lists child elements that the object contains, specified as a cell array.

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.





Open presentation.


Close presentation.


Search in presentation.

Use the Presentation.find method the same way you use the Slide.find method.


Replace content in presentation.


Add content to presentation.


Get names of slide masters for presentation


Get names of layouts for presentation.


Get table style names for presentation.


expand all

Create a presentation with three slides. Use the default PPT presentation template.

import mlreportgen.ppt.*

slides = Presentation('myFirstPresentation');

add(slides,'Title Slide');
add(slides,'Title and Content');
add(slides,'Title and Picture');

Examine the slides Presentation object.

slides = 

  Presentation with properties:

    TemplatePath: 'matlab/toolbox/shared/mlreportgen/ppt/resources/...'
      OutputPath: 'myFirstPresentation.pptx'
        Children: [1x3 mlreportgen.ppt.Slide]
          Parent: []
             Tag: 'ppt.Presentation:1181'
              Id: '1181'

Examine the first slide.

ans = 

  Slide with properties:

         Layout: 'Title Slide'
    SlideMaster: 'Office Theme'
           Name: ''
          Style: []
       Children: [1x2 mlreportgen.ppt.TextBoxPlaceholder]
         Parent: [1x1 mlreportgen.ppt.Presentation]
            Tag: 'ppt.Slide:1183'
             Id: '1183'

Specify a title for the presentation. Find the Title placeholder in the first slide and provide a title. Make the title red.

contents = find(slides,'Title');
replace(contents(1),'My First Presentation');
contents(1).FontColor = 'red';

Add content to the second slide.

contents = find(slides,'Content');
replace(contents,{'Subject A','Subject B','Subject C'});

Close the presentation to generate the output.


Open myFirstPresentation.pptx. On a Windows® platform, you can open the presentation in MATLAB®:

if ispc

Create a presentation with using the myFirstPresentation presentation as the template (see the previous example).

import mlreportgen.ppt.*

slides = Presentation('mySecondPresentation','myFirstPresentation');

Change the title to My Second Presentation.

contents = find(slides,'Title');
replace(contents(1),'My Second Presentation');

Close the presentation to generate the output.


Open mySecondPresentation.pptx. On a Windows platform, you can open the presentation in MATLAB:

if ispc

Introduced in R2015b

Was this topic helpful?