PPT.FitGraphicIntoShape | R Documentation |
Sometimes shapes serve as placeholders for an image. The function takes a shape, fits an image in its position and deletes the placeholder shape afterwards.
PPT.FitGraphicIntoShape(
ppt,
file,
shp,
hjust = "center",
vjust = "center",
proportional = TRUE,
maxscale = 1,
delete.shape = TRUE,
...
)
ppt |
The ppt object as used in R2PPT. |
file |
Path to the image file. |
shp |
Pointer to the shape which the image is fitted into. |
hjust, vjust |
Horizontal und vertical alignment of image inside frame.
Either a string ( |
proportional |
Logical (default |
maxscale |
Threshold below which values are interpreted as proportional
scaling factors for the |
delete.shape |
Whether to destroy the placeholder shape afterwards
(default |
## Not run:
# create new PPT object and add one slide
p <- PPT.Init(visible=T, method = "RDCOMClient")
p <- PPT.AddBlankSlide(p)
# add two rectangle shapes to slide
p <- PPT.AddRectangle(p, width = .4, left=.1) # add a shape to slide
p <- PPT.AddRectangle(p, width = .4, left=.5, height=.45, top=.5) # add a shape to slide
# get all shapes on current slide and replace by image
# shapes are not destroyed to see the image placement
s <- PPT.ShapesOnCurrentSlide(p)
file <- system.file("image_1.png", package = "R2PPTaddons") # get image
p <- PPT.FitGraphicIntoShape(p, file, shp=s[[1]], vjust="top", delete.shape =FALSE)
p <- PPT.FitGraphicIntoShape(p, file, shp=s[[2]], vjust="bottom", delete.shape =FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.