Main Content


Class: mlreportgen.ppt.Slide
Namespace: mlreportgen.ppt

Search slide for content



searchResults = find(slide,objectName) searches a slide for a slide content object whose Name property value matches objectName.


expand all

Find a content object in an mlreportgen.ppt.Slide object by using the find method.

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 a presentation.

ppt = Presentation('mySlideFindPresentation.pptx');

Add a slide with a Title and Content layout.

slide = add(ppt,'Title and Content');

Search the slide for a content object that has the Name property value 'Content'.

contents = find(slide,'Content')
contents = 
  ContentPlaceholder with properties:

                 Bold: []
                 Font: []
    ComplexScriptFont: []
            FontColor: []
             FontSize: []
               Italic: []
               Strike: []
            Subscript: []
          Superscript: []
            Underline: []
      BackgroundColor: []
               VAlign: []
                 Name: 'Content'
                    X: []
                    Y: []
                Width: []
               Height: []
                Style: []
             Children: []
               Parent: [1×1 mlreportgen.ppt.Slide]
                  Tag: 'ppt.ContentPlaceholder:198:244'
                   Id: '198:244'

find returns a 1-by-1 array that contains an mlreportgen.ppt.ContentPlaceholder object. Specify that the text in the placeholder object is bold and add text to the object.

contents(1).Bold = true;
add(contents(1),'This is bold text');

Close and view the presentation.


Here is the generated presentation:

Input Arguments

expand all

Slide to search, specified as an mlreportgen.ppt.Slide object.

Name property value to search for, specified as a character vector or string scalar.

When you add a slide to a presentation, the add method sets the Name property of the content objects in the slide based on the slide layout. See getLayoutNames. The Name property values include:

  • 'Title'

  • 'Content'

  • 'Table'

  • 'Picture'

  • 'Text'

  • 'Vertical Text'

The Name property can also be set to a custom value.

Output Arguments

Version History

Introduced in R2015b