
Copy media from a docx or pptx file or a rdocx or rpptx object to a target folder
Source:R/officer_media.R
officer_media.RdUnzip a docx or pptx file to a temporary directory, check if the directory
contains a media folder, and copy media files to the directory set by dir. If
a rdocx or rpptx object is provided, files are copied from the temporary
package_dir associated with the object (accessible via x[["package_dir"]]).
Usage
officer_media(
filename = NULL,
path = NULL,
x = NULL,
target = "media",
list = FALSE,
overwrite = TRUE
)Arguments
- filename, path
File name and path for a
docxorpptxfile. One of the two must be provided. Ignored if x is provided. Defaults toNULL.- x
A rdocx or rpptx object containing one or more media file.
- target
Folder name or path to copy media files. dir is created if no folder exists at that location.
- list
If
TRUE, display a message listing files contained in the docx or pptx file but do not copy the files to dir. Defaults toFALSE.- overwrite
If
TRUE(default), overwrite any files with the same names at target path. IfFALSE, abort if files with the same names already exist.
Value
Invisibly returns the paths of the copied (or, if list is
TRUE, listed) media files, or NULL if no media files are found.
Examples
officer_media(
system.file("doc_examples/example.pptx", package = "officer"),
list = TRUE
)
#> ℹ 1 media file found in example.pptx
#> • image1.png