Main Content

Use Format Properties

Most PPT API presentation objects (such as a Paragraph object) include properties that you can use to set the format of the content of an object.

Dot Notation

To work with PPT API object properties, you use dot notation. Using dot notation involves specifying an object (the variable representing the object) followed by a period and then the property name. For example, suppose that you create a Paragraph object para1.

par1 = Paragraph('My paragraph');

To specify the Bold property for the para1 object, use:

par1.Bold = true;

Get the Properties of an Object

To display all the properties of an object that you create, use one of these approaches in MATLAB®:

  • Omit the semicolon when you create the object.

  • Enter the name of the object.

For example, display the properties of the Paragraph object para1.

para1 = Paragraph('My paragraph')
para1 = 

  Paragraph with properties:

           Bold: []
      FontColor: []
         Italic: []
         Strike: []
      Subscript: []
    Superscript: []
      Underline: []
          Level: []
          Style: []
       Children: [1x1 mlreportgen.ppt.Text]
         Parent: []
            Tag: 'ppt.Paragraph:22'
             Id: '22'

To display the value of a specific property, such as the Bold property, use dot notation, without a semicolon.

par1 = Paragraph('My paragraph');
para.Bold
ans =

     []

Set the Properties of an Object

You can set some PPT API object properties using the object constructor. The PPT API sets other properties. For most PPT API objects, you can change the values of properties that you specified in the constructor. Also, you can specify values for additional properties.

To specify a value for an object property, use dot notation. For example, to set the default for text in the para1 paragraph to bold:

par1 = Paragraph('My paragraph');
para1.Bold = true;

For some presentation objects, you can use the Style property to specify formatting options that are not available in the other properties of the object. For example, a TableEntry object does not have a Bold property. However, you can specify bold as the default for text in the TableEntry by using the Style property of the TableEntry object.

te = tableEntry();
te.Style = {Bold(true)};

Related Examples

More About