mlreportgen.ppt.Picture Class
Namespace: mlreportgen.ppt
Picture to include in presentation
Description
Use an object of the mlreportgen.ppt.Picture
class to include a picture
in a presentation.
The mlreportgen.ppt.Picture
class is a handle
class.
Class Attributes
ConstructOnLoad | true |
HandleCompatible | true |
For information on class attributes, see Class Attributes.
Creation
Description
creates an empty pictureObj
= mlreportgen.ppt.PicturePicture
object.
creates a pictureObj
= mlreportgen.ppt.Picture(picturePath
)Picture
object that contains the picture specified by
picturePath
.
Note
The contents of the specified picture file are copied into the output
presentation when the presentation is closed. Do not delete or overwrite the
picture file before it is copied into the presentation. If you create a picture
file and the corresponding mlreportgen.ppt.Picture
object in a
loop, use a unique file name for the picture file in each loop iteration.
Input Arguments
picturePath
— Path and name of picture file
character vector | string scalar
Path and name of a picture file, specified as a character vector or string scalar. The PPT API supports the image formats in the table.
Image Format | File Extension |
---|---|
Windows® Enhanced Metafile | .emf |
Encapsulated PostScript® | .eps |
Graphics Interchange Format | .gif |
Joint Photographic Experts Group | .jpeg , .jpg |
Portable Network Graphics | .png |
Scalable Vector Graphics | .svg |
Tagged Image File Format | .tif , .tiff |
Note
To ensure that the image formats used in your generated presentation are supported by the PowerPoint® version that you are using, see File formats that are supported in PowerPoint on the Microsoft® website.
Properties
Path
— Picture file path
character vector | string scalar
Picture file path, specified as a character vector or string scalar.
Data Types: char
| string
LinkTarget
— Picture hyperlink target
[]
(default) | integer | character vector | string scalar
Internal or external hyperlink target for the picture, specified as an
integer, string scalar, or character vector. Use an integer to specify the
index of the target slide within the presentation. Use a character vector or
string scalar to specify an external URL. When specifying an external URL,
use the fully qualified URL. For example, include
http://
.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
| char
| string
Name
— Picture name
character vector | string scalar
Picture name, specified as a character vector or string scalar.
Attributes:
NonCopyable | true |
Data Types: char
| string
X
— Upper-left x-coordinate position
character vector | 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
Note
When the PPT API creates an mlreportgen.ppt.Picture 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
Y
— Upper-left y-coordinate position
character vector | string scalar
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.Picture 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
— Width of picture
character vector | string scalar
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.Picture 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
— Height of picture
character vector | string scalar
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.Picture 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
Style
— This property is ignored
not applicable
The class ignores this property.
Attributes:
NonCopyable | true |
Parent
— Parent of mlreportgen.ppt.Picture
object
PPT API object
Parent of this object, specified as a PPT API object. A PPT API object must only have one parent.
Attributes:
SetAccess | private |
NonCopyable | true |
Children
— Children of mlreportgen.ppt.Picture
object
cell array of PPT API objects
Child elements of mlreportgen.ppt.Picture
object, specified as a cell array of PPT
API objects.
Attributes:
NonCopyable | true |
Tag
— Tag for mlreportgen.ppt.Picture
object
character vector | string scalar
Tag for the mlreportgen.ppt.Picture
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
Id
— Object identifier for mlreportgen.ppt.Picture
object
character vector | string scalar
Object identifier for the mlreportgen.ppt.Picture
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
Examples
Include a Picture in a Presentation
Use an mlreportgen.ppt.Picture
object to include a picture of an airplane in a presentation.
Create a presentation.
import mlreportgen.ppt.* ppt = Presentation("myPicturePresentation.pptx"); open(ppt);
Add a slide with a Title and Content
layout to the presentation.
add(ppt,"Title and Content");
Create a Picture
object using an image of an airplane. Specify the size of the picture.
plane = Picture(which("b747.jpg")); plane.Width = "5in"; plane.Height = "2in";
Replace the content of the slide with the picture.
replace(ppt,"Content",plane);
Close and view the presentation.
close(ppt); rptview(ppt);
Here is the generated slide with the image of the airplane:
Add Figure Snapshot to Presentation
To add an image of a MATLAB figure to a presentation, this example prints the figure to an image file, creates an mlreportgen.ppt.Picture
object from the file, and adds the Picture
object to a slide in the presentation.
Create a presentation.
import mlreportgen.ppt.* ppt = Presentation("myFigurePresentation.pptx"); open(ppt);
Add a slide to the presentation.
slide = add(ppt,"Title and Content");
Add a title to the slide.
replace(slide,"Title","surf(peaks)");
Create a MATLAB figure with a surface plot.
fig = figure; surf(peaks);
Print the figure to an image file. Do not delete the image file before generating the presentation.
figSnapshotImage = "figSnapshot.png"; print(fig,"-dpng",figSnapshotImage);
Create an mlreportgen.ppt.Picture
object using the image file.
figPicture = Picture(figSnapshotImage);
Add the Picture
object to the slide.
replace(slide,"Content",figPicture);
Close the presentation.
close(ppt);
Delete the figure and the image file.
delete(fig); delete(figSnapshotImage);
View the presentation.
rptview(ppt);
Here is the generated slide with the image of the figure:
Version History
Introduced in R2015bR2024b: Removal of BMP for image output
Report Generator no longer supports BMP (bitmap) as an output image format. This affects
snapshots, images from files, and watermarks in both the Report Explorer and the Report,
DOM, and PPT APIs. See print
for more information.
R2021b: SVG support
Starting in R2021b, the mlreportgen.ppt.Picture
class supports
Scalable Vector Graphics (SVG) images. To ensure that your version of PowerPoint supports SVG images, see File formats that are supported in PowerPoint on the Microsoft website.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)