mlreportgen.ppt.TemplatePicture class

Package: 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

For information on class attributes, see Class Attributes (MATLAB).

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. 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.

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

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

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

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.

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

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

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.

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 (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

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.

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 (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

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.

This property is ignored.

This read-only property is empty.

Parent of this object, specified as a PPT object. This property is read-only.

ID for this PPT API object, specified as a character vector or string scalar. 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 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 an issue occurred during presentation generation.

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);

Introduced in R2019b