Main Content

mlreportgen.ppt.TablePlaceholder Class

Namespace: mlreportgen.ppt

Placeholder for slide table

Description

An object of the mlreportgen.ppt.TablePlaceholder class represents a table placeholder in a slide.

The PPT API creates a TablePlaceholder object when you add a slide to a presentation and the slide layout has a table placeholder. In the default PPT API, the Title and Table layout has a table placeholder.

To find a TablePlaceholder object, use the find method of the slide that contains the table placeholder. To replace the table placeholder with a table, use the replace method of the TablePlaceholder object. The replace method replaces the TablePlaceholder object with an mlreportgen.ppt.Table object.

You can use the properties of a TablePlaceholder object to specify the position or size of the replacement table. However, the text formatting properties are ignored. To format the table that you use to replace a TablePlaceholder object, use the properties of the Table object.

The mlreportgen.ppt.TablePlaceholder class is a handle class.

Class Attributes

HandleCompatible
true
ConstructOnLoad
true

For information on class attributes, see Class Attributes.

Properties

expand all

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

NonCopyable
true

The class ignores this property.

Attributes:

NonCopyable
true

Table placeholder name, specified as a character vector or string scalar.

Upper-left x-coordinate position, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "5in" specifies five inches. Valid abbreviations are:

  • "px" — pixels

  • "cm" — centimeters

  • "in" — inches

  • "mm" — millimeters

  • "pc" — picas

  • "pt" — points

Attributes:

NonCopyable
true

Data Types: char | string

Upper-left y-coordinate position, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "5in" specifies five inches. Valid abbreviations are:

  • "px" — pixels

  • "cm" — centimeters

  • "in" — inches

  • "mm" — millimeters

  • "pc" — picas

  • "pt" — points

Attributes:

NonCopyable
true

Data Types: char | string

Width of the table placeholder, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, '5in' specifies five inches. Valid abbreviations are:

  • "px" — pixels

  • "cm" — centimeters

  • "in" — inches

  • "mm" — millimeters

  • "pc" — picas

  • "pt" — points

Data Types: char | string

Height of the table placeholder, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, '5in' specifies five inches. Valid abbreviations are:

  • "px" — pixels

  • "cm" — centimeters

  • "in" — inches

  • "mm" — millimeters

  • "pc" — picas

  • "pt" — points

Data Types: char | string

The class ignores this property.

Attributes:

NonCopyable
true

Child elements of this PPT API object, specified as a cell array of PPT API objects.

Attributes:

NonCopyable
true

Parent of this object, specified as a PPT object.

Attributes:

SetAccess
private
NonCopyable
true

ID for this PPT API object, specified as a character vector or string scalar. A session-unique ID is generated as part of the object creation. You can specify an ID to replace the generated ID.

Attributes:

NonCopyable
true

Data Types: char | string

Tag for this PPT API object, specified as a character vector or string scalar. A session-unique tag is generated as part of the creation of this object. 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.

Specifying your own tag value can help you to identify where issues occur during presentation generation.

Attributes:

NonCopyable
true

Data Types: char | string

Methods

expand all

Examples

collapse all

Add a Title and Table slide to a presentation and then replace the title and table placeholders with your own title and table.

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("myTablePlaceholderPresentation.pptx");
open(ppt);

Add a slide that has a Title and Table layout.

slide = add(ppt,"Title and Table");

Use the find method of the slide object to find the placeholder object that has the name Title.

titlePlaceholderObj = find(slide,"Title")
titlePlaceholderObj = 
  TextBoxPlaceholder with properties:

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

The find method returns an mlreportgen.ppt.TextBoxPlaceholder object.

Replace the placeholder content with the title text.

replace(titlePlaceholderObj,"Fourth-Order Magic Square");

Use the find method of the slide object to find the placeholder object that has the name Table.

tablePlaceholderObj = find(slide,"Table")
tablePlaceholderObj = 
  TablePlaceholder with properties:

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

The find method returns an mlreportgen.ppt.TablePlaceholder object.

Replace the table placeholder with a table for a fourth-order magic square.

replace(tablePlaceholderObj,Table(magic(4)));

Close and view the presentation

close(ppt);
rptview(ppt);

Here is the slide in the generated presentation:

Tips

  • When you replace a table placeholder with a table in a presentation and then use the presentation as a template for a new presentation, the PPT API creates an mlreportgen.ppt.TemplateTable object for the table in the new presentation. See Add or Replace a Table.

  • To see the placeholder objects that the PPT API creates for a slide object, view the Children property of the slide. For example, when you add a Title and Table slide to a presentation, the Children property is an array that contains an mlreportgen.ppt.TextBoxPlaceholder object and an mlreportgen.ppt.TablePlaceholder object.

    ppt = mlreportgen.ppt.Presentation("test.pptx");
    open(ppt);
    slide = add(ppt,"Title and Table");
    slide.Children(1)
    
    ans = 
    
      TextBoxPlaceholder with properties:
    
                     Bold: []
                     Font: []
        ComplexScriptFont: []
                FontColor: []
                 FontSize: []
                   Italic: []
                   Strike: []
                Subscript: []
              Superscript: []
                Underline: []
          BackgroundColor: []
                   VAlign: []
                     Name: 'Title'
                        X: []
                        Y: []
                    Width: []
                   Height: []
                    Style: []
                 Children: []
                   Parent: [1×1 mlreportgen.ppt.Slide]
                      Tag: 'ppt.TextBoxPlaceholder:6:7'
                       Id: '6:7'

    slide.Children(2)
    
    ans = 
    
      TablePlaceholder with properties:
    
                     Bold: []
                     Font: []
        ComplexScriptFont: []
                FontColor: []
                 FontSize: []
                   Italic: []
                   Strike: []
                Subscript: []
              Superscript: []
                Underline: []
          BackgroundColor: []
                   VAlign: []
                     Name: 'Table'
                        X: []
                        Y: []
                    Width: []
                   Height: []
                    Style: []
                 Children: []
                   Parent: [1×1 mlreportgen.ppt.Slide]
                      Tag: 'ppt.TablePlaceholder:7:8'
                       Id: '7:8'

Version History

Introduced in R2015b