Main Content

find

Class: mlreportgen.ppt.Presentation
Namespace: mlreportgen.ppt

Search a presentation

Description

example

searchResults = find(presentation,objectName) searches the specified presentation for the content or slide objects whose Name property value matches objectName.

Examples

expand all

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. Add two slides that have titles.

ppt = Presentation('myPresentation.pptx');
open(ppt);
add(ppt,'Title Slide');
add(ppt,'Title and Content');

Find presentation objects whose Name property is Title.

contents = find(ppt,'Title')

The find method returns a 1-by-2 array of mlreportgen.ppt.TextBoxPlaceholder objects. The first object is for the title in the first slide and the second object is for the title in the second slide.

Replace the title in the first slide with My Presentation Title.

p = Paragraph('My Presentation Title');
replace(contents(1),p);

Close and view the presentation.

close(ppt);
rptview(ppt);

Here is the generated presentation:

Input Arguments

expand all

Presentation to search, specified as an mlreportgen.ppt.Presentation 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 on 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

expand all

Search results, returned as an array of content or slide objects. The array can contain content objects, such as:

The array can also contain mlreportgen.ppt.Slide objects.

Version History

Introduced in R2015b