Main Content

mlreportgen.ppt.TemplatePicture Class

Namespace: mlreportgen.ppt

Picture from template presentation slide

Description

Objects of the mlreportgen.ppt.TemplatePicture represent template pictures. A template picture is a picture that comes from a slide in the template presentation. Customize a template picture by modifying properties of the associated mlreportgen.ppt.TemplatePicture object. Replace a template picture with another picture by using the replace method of the mlreportgen.ppt.TemplatePicture object.

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

Class Attributes

HandleCompatible
true
ConstructOnLoad
true

For information on class attributes, see Class Attributes.

Creation

You do not create an mlreportgen.ppt.TemplatePicture object explicitly. When you create a presentation from an existing presentation, the MATLAB® API for PowerPoint® (PPT API) creates an mlreportgen.ppt.TemplatePicture object for each picture that comes from a slide in the template presentation.

You can access the mlreportgen.ppt.TemplatePicture object for a template picture by using:

Note

Pictures that you add to a new presentation are represented as mlreportgen.ppt.Picture objects.

Properties

expand all

XML markup of template picture, specified as a character vector or string scalar. You can modify the template picture by changing the XML markup. Modify the XML markup for customizations for which there is no property. The updated markup is written to the generated presentation. If you update other properties, such as X, Y, Width, or Height, the corresponding attributes in the XML markup are updated before the markup is written to the generated presentation.

Attributes:

NonCopyable
true

Data Types: char | string

Picture name, specified as a character vector or string scalar.

Attributes:

NonCopyable
true

Data Types: char | string

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

Note

When the PPT API creates an mlreportgen.ppt.TemplatePicture object, this property value is specified in English Metric Units (EMU). If you set this property, you must use one of the units in the previous list.

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

Note

When the PPT API creates an mlreportgen.ppt.TemplatePicture object, this property value is specified in English Metric Units (EMU). If you set this property, you must use one of the units in the previous list.

Attributes:

NonCopyable
true

Data Types: char | string

Width of picture, 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

Note

When the PPT API creates an mlreportgen.ppt.TemplatePicture object, this property value is specified in English Metric Units (EMU). If you set this property, you must use one of the units in the previous list.

Data Types: char | string

Height of picture, 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

Note

When the PPT API creates an mlreportgen.ppt.TemplatePicture object, this property value is specified in English Metric Units (EMU). If you set this property, you must use one of the units in the previous list.

Data Types: char | string

The class ignores this property.

Attributes:

NonCopyable
true

Parent of this object, specified as a PPT API object. A PPT API object must only have one parent.

Attributes:

SetAccess
private
NonCopyable
true

The class ignores this property.

Attributes:

SetAccess
private
NonCopyable
true

Tag for the mlreportgen.ppt.TemplatePicture object, specified as a character vector or string scalar. The PPT API generates a session-unique tag 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. Specify your own tag value to help you identify where to look when an issue occurs during document generation.

Attributes:

NonCopyable
true

Data Types: char | string

Object identifier for the mlreportgen.ppt.TemplatePicture object, specified as a character vector or string scalar. The PPT API generates a session-unique identifier when it creates the document element object. You can specify your own value for Id.

Attributes:

NonCopyable
true

Data Types: char | string

Methods

expand all

Examples

collapse all

Generate a presentation, MyPicturePresentation, that you then use as the template presentation for another presentation. MyPicturePresentation has two slides, and each slide has one picture.

import mlreportgen.ppt.*
ppt = Presentation("MyPicturePresentation");
open(ppt);

slide1 = add(ppt,"Title and Picture");
replace(slide1,"Title","Plane");
replace(slide1,"Picture",Picture("b747.jpg"));

slide2 = add(ppt,"Title and Picture");
replace(slide2,"Title","Street");
replace(slide2,"Picture",Picture("street1.jpg"));

Close and view the presentation.

close(ppt);
rptview(ppt);

Create a presentation, MyNewPicturePresentation, from MyPicturePresentation. MyPicturePresentation is the template presentation for MyNewPicturePresentation.

ppt = Presentation("MyNewPicturePresentation","MyPicturePresentation");
open(ppt);

Find the template pictures by using the find method of the slide objects. Because the pictures come from the template presentation, find returns the pictures as mlreportgen.ppt.TemplatePicture objects.

slide1 = ppt.Children(1);
slide2 = ppt.Children(2);
templatePictureObj1 = find(slide1,"Picture")
templatePictureObj1 = 
  TemplatePicture with properties:

    XMLMarkup: '<p:pic><p:nvPicPr><p:cNvPr id="8" name="Picture"/><p:cNvPicPr><a:picLocks noChangeAspect="1" noGrp="1"/></p:cNvPicPr><p:nvPr><p:ph idx="13" sz="quarter" type="pic"/></p:nvPr></p:nvPicPr><p:blipFill><a:blip r:embed="rId2"/><a:stretch><a:fillRect/></a:stretch></p:blipFill><p:spPr/></p:pic>'
         Name: 'Picture'
            X: []
            Y: []
        Width: []
       Height: []
        Style: []
     Children: []
       Parent: [1×1 mlreportgen.ppt.Slide]
          Tag: 'ppt.TemplatePicture:435:246'
           Id: '435:246'

templatePictureObj2 = find(slide2,"Picture")
templatePictureObj2 = 
  TemplatePicture with properties:

    XMLMarkup: '<p:pic><p:nvPicPr><p:cNvPr id="8" name="Picture"/><p:cNvPicPr><a:picLocks noChangeAspect="1" noGrp="1"/></p:cNvPicPr><p:nvPr><p:ph idx="13" sz="quarter" type="pic"/></p:nvPr></p:nvPicPr><p:blipFill><a:blip r:embed="rId2"/><a:stretch><a:fillRect/></a:stretch></p:blipFill><p:spPr/></p:pic>'
         Name: 'Picture'
            X: []
            Y: []
        Width: []
       Height: []
        Style: []
     Children: []
       Parent: [1×1 mlreportgen.ppt.Slide]
          Tag: 'ppt.TemplatePicture:439:248'
           Id: '439:248'

Change the size of the picture on the first slide.

templatePictureObj1.Width = "4in";
templatePictureObj1.Height = "3in";

Replace the picture on the second slide with a picture of a different street.

replace(templatePictureObj2,Picture("street2.jpg"));

Close and view the presentation.

close(ppt);
rptview(ppt);

Version History

Introduced in R2019b