mlreportgen.ppt.Picture类
Package:mlreportgen.ppt
Picture to include in presentation
Description
Use an object of themlreportgen.ppt.Picture
class to include a picture in a presentation.
Themlreportgen.ppt.Picture
class is ahandle
class.
Class Attributes
ConstructOnLoad |
true
|
HandleCompatible |
true
|
For information on class attributes, seeClass Attributes.
Creation
Description
creates an emptypictureObj
= mlreportgen.ppt.Picture()Picture
object.
creates apictureObj
= mlreportgen.ppt.Picture(picturePath
)Picture
object that contains the picture specified bypicturePath
.
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 correspondingmlreportgen.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
string scalar|character vector
Path and name of a picture file, specified as a string scalar or character vector. The PPT API supports the image formats in the table.
Image Format | File Extension |
---|---|
Bitmap | .bmp |
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 your version of PowerPoint®supports the image formats used in your generated presentation, seeFile formats that are supported in PowerPointon the Microsoft®website.
Properties
Path
—Picture file path
string scalar|character vector
Picture file path, specified as a string scalar or character vector.
LinkTarget
—Picture hyperlink target
integer|string scalar|character vector
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, includehttp://
.
Name
—Picture name
string scalar|character vector
Picture name, specified as a string scalar or character vector.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
NonCopyable |
true
|
X
—Upper-leftx-coordinate position of picture
string scalar|character vector
Upper-leftx-coordinate position of the picture, specified as a string scalar or character vector 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
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
Attributes:
GetAccess |
public
|
SetAccess |
public
|
NonCopyable |
true
|
Y
—Upper-lefty-coordinate position of picture
string scalar|character vector
Upper-lefty-coordinate position of the picture, specified as a string scalar or character vector 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
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
Attributes:
GetAccess |
public
|
SetAccess |
public
|
NonCopyable |
true
|
Width
—Width of picture
string scalar|character vector
Width of the picture, specified as a string scalar or character vector 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
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
Attributes:
GetAccess |
public
|
SetAccess |
public
|
NonCopyable |
true
|
Height
—Height of picture
string scalar|character vector
Height of the picture, specified as a string scalar or character vector 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
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
Attributes:
GetAccess |
public
|
SetAccess |
public
|
NonCopyable |
true
|
Style
—Picture placeholder formatting
ignored
Picture placeholder formatting. This property is ignored.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
NonCopyable |
true
|
Children
—Children of this PPT API object
cell array of PPT API objects
Child elements of this PPT API object, specified as a cell array of PPT API objects.
Attributes:
GetAccess |
public
|
SetAccess |
private
|
NonCopyable |
true
|
Parent
—Parent of this PPT API object
PPT API object
Parent of this PPT API object, specified as a PPT API object.
Attributes:
GetAccess |
public
|
SetAccess |
private
|
NonCopyable |
true
|
Tag
—Tag for this PPT API object
string scalar|character vector
标记这个PPT API对象,指定为一个字符串scalar or character vector. A session-unique tag is generated as part of the creation of this object. The generated tag has the formCLASS:ID
, whereCLASS
is the object class andID
is the value of theId
property of the object.
Specifying your own tag value can help you to identify where issues occur during presentation generation.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
NonCopyable |
true
|
Id
—ID for this PPT API object
string scalar|character vector
ID for this PPT API object, specified as a string scalar or character vector. A session-unique ID is generated as part of the object creation. You can specify an ID to replace the generated ID.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
NonCopyable |
true
|
Methods
Examples
Include a Picture in a Presentation
Use anmlreportgen.ppt.Picture
object to include a picture of an airplane in a presentation.
创建一个presentation.
importmlreportgen.ppt.*ppt = Presentation("myPicturePresentation.pptx"); open(ppt);
Add a slide with aTitle and Content
layout to the presentation.
add(ppt,"Title and Content");
创建一个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 anmlreportgen.ppt.Picture
object from the file, and adds thePicture
object to a slide in the presentation.
创建一个presentation.
importmlreportgen.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)");
创建一个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);
创建一个nmlreportgen.ppt.Picture
object using the image file.
figPicture = Picture(figSnapshotImage);
Add thePicture
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 R2015bR2021b:SVG support
Starting in R2021b, themlreportgen.ppt.Picture
class supports Scalable Vector Graphics (SVG) images. To ensure that your version of PowerPoint supports SVG images, seeFile formats that are supported in PowerPointon the Microsoft website.
Beispiel öffnen
Sie haben eine geänderte Version dieses Beispiels. Möchten Sie dieses Beispiel mit Ihren Änderungen öffnen?
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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)