Documentation

This is machine translation

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

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

mlreportgen.ppt.ContentPlaceholder class

Package: mlreportgen.ppt
Superclasses:

Placeholder for presentation content in slide

Description

Placeholder for replaceable content in a slide. Represents slide content that can be replaced by a paragraph, picture, or table. It can also represent slide content that includes one or more paragraphs. Use the PowerPoint® editor to create content placeholders in a PowerPoint template or presentation for content that you want to replace programmatically.

You can use a Presentation.find or Slide.find method to find content placeholders in a presentation or a slide. The find method returns the content placeholders as instances of this class. You can also access slide content placeholders by accessing its children using its Children property. If a child is an object of this type, you can replace it with a paragraph, picture, or table, using the replace method of the type of object that you want to replace. If the content placeholder object is empty or already contains paragraphs, you can add paragraphs to the content, using the ContentPlaceholder.add method.

The text format properties of the placeholder object specify the default format for content that replaces the placeholder.

Properties

expand all

Option to use bold for paragraphs contained in placeholder, specified as a logical value. This property sets the default format, which you can override for specific Paragraph objects. Setting the Bold property adds a corresponding mlreportgen.ppt.Bold format object to the Style property of this presentation element. Removing the Bold property setting removes the object.

Data Types: logical

Font color for paragraphs included in placeholder, specified as a character vector. Use either a CSS color name or a hexadecimal RGB value. This property sets the default format, which you can override for specific Paragraph objects.

  • For a list of CSS color names, see http://www.crockford.com/wrrrld/color.html.

  • To specify a hexadecimal RGB format, use # as the first character and two-digit hexidecimal numbers for each the red, green, and blue values. For example, '#0000ff' specifies blue.

Option to use italics for paragraphs included in placeholder, specified as a logical value. This sets the default format, which you can override for specific Paragraph objects. Setting the Italic property adds a corresponding mlreportgen.ppt.Italic format object to the Style property of this presentation element. Removing the Italic property setting removes the object.

Data Types: logical

Option to underline paragraphs included in placeholder, specified as a character vector. This property sets the default format, which you can override for specific Paragraph objects. You can specify one of these types of underlines.

ValueDescription
'single'Single underline
'double'Double underline
'heavy'Thick underline
'words'Only words underlined (not spaces)
'dotted'Dotted underline
'dottedheavy'Thick, dotted underline
'dash'Dashed underline
'dashheavy'Thick, dashed underline
'dashlong'Long, dashed underline
'dashlongheavy'Thick, long, dashed underline
'dotdash'Dot-dash underline
'dotdotdash'Dot-dot-dash underline
'dotdotdashheavy'Thick dot-dot-dash underline
'dotdashdotheavy'Thick dash-dot underline
'wavy'Wavy underline
'wavyheavy'Thick, wavy underline
'wavydouble'Two wavy underlines

Setting the Underline property adds a corresponding mlreportgen.ppt.Underline format object to the Style property for this element. Removing the Underline property setting removes the object.

Content placeholder name, specified as a character vector.

Upper-left x coordinate of placeholder content, specified in the form valueUnits where Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Upper-left y coordinate of placeholder content, specified in the form valueUnits where Units is an abbreviation for the unit. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Width of placeholder, specified in the form valueUnits where Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Height of placeholder, specified in the form valueUnits where Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Formatting for the paragraphs included in placeholder, specified as an array of PPT style objects. This sets the default format, which you can override for specific Paragraph objects. You can specify these mlreportgen.ppt style objects:

  • BackgroundColor object

  • FontFamily object

  • FontSize object

  • Bold object

  • FontColor object

  • Italic object

  • Underline object

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

This read-only property lists the parent of this object, specified a PPT object.

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.

Methods

Method

Purpose

add

Add content to the placeholder.

replace

Replace placeholder with the content.

Examples

expand all

Create a presentation.

import mlreportgen.ppt.*

slidesFile = 'myPlaceholderPresentation.pptx';
slides = Presentation(slidesFile);

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

close(slides);
% Open myPlaceholderPresentatiopresentation.pptx. 
% On Windows platforms, you can run this code.

if ispc
    winopen(slidesFile);
end

In the myPlaceholderPresentation.pptx presentation file, In the Home tab, select Select > Selection Pane.

Select the first slide, place the cursor in the Click to add text and type Topic 1.

In the Selection pane, the placeholder is called Content.

Change the Content object name to Agenda.

In the PowerPoint editor, save and close the presentation.

In MATLAB®, create a presentation that uses myPlaceholderPresentation as the presentation template.

slides = Presentation('myPlaceholderPresentation','myPlaceholderPresentation');

Use the mlreportgen.ppt.Presentation.find method to find the slides that have an Agenda placeholder. In this case, there is only one.

contents = find(slides,'Agenda')
ContentPlaceholder with properties:

contents =

           Bold: []
      FontColor: []
         Italic: []
         Strike: []
      Subscript: []
    Superscript: []
      Underline: []
           Name: 'Agenda'
              X: []
              Y: []
          Width: []
         Height: []
          Style: []
       Children: []
         Parent: [1x1 mlreportgen.ppt.Slide]
            Tag: 'ppt.ContentPlaceholder:11127:4401'
             Id: '11127:4401'  

Add text to the replace the content placeholder in the first slide. Make the text bold.

replace(contents(1),{'Subject 1','Subject 2','Subject 3'});
contents(1).Bold = true;

Close the presentation to generate the output.

close(slides);

if ispc
    winopen(slidesFile);
end

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

The bullets in the first slide reflect the replaced content for the Agenda placeholder.

Introduced in R2015b

Was this topic helpful?