wdReplaceTextByImage: Replaces a string with an image

Description Usage Arguments Value TODO Examples

View source: R/addons.R

Description

This function replaces a piece of text with an image.

Usage

1
2
wdReplaceTextByImage(find = "", file, wdapp = .R2wd, wd = getwd(),
  warn = TRUE)

Arguments

find

A string.

file

The path to the image.

Value

Invisibly returns a pointer to new inlineshape object.

TODO

handle case if text is found multiple times

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
file <- system.file("inst/template.docx", package = "R2wdaddons")
wdGet2(file)

# image file to put in document
img <- system.file("inst/sky.jpeg", package = "R2wdaddons")

# replace and rescale first image
shp <- wdReplaceTextByImage("[placeholder 1]", img)
wdScaleImage(ishp = shp, width=200, units="px")
wdAddImageCaption(ishp = shp, title = "Image is 200 pixels wide")

markheckmann/R2wdaddons documentation built on Sept. 13, 2019, 8:40 a.m.