ReporteRs (version 0.7.3)

addImage.docx: Add external image into a docx object

Description

Add external images into a docx object.

Usage

# S3 method for docx
addImage(doc, filename, bookmark,
  par.properties = parProperties(text.align = "center", padding = 5), width,
  height, ...)

Arguments

doc

Object of class docx where external image has to be added

filename

"character" value, complete filename of the external image

bookmark

a character value ; id of the Word bookmark to replace by the image. optional. if missing, image is added at the end of the document. See bookmark.

par.properties

paragraph formatting properties of the paragraph that contains images. An object of class parProperties

width

image width in inch

height

image height in inch

...

further arguments, not used.

Value

an object of class docx.

See Also

docx, addPlot.docx , addImage, bookmark

Examples

Run this code
# NOT RUN {
#START_TAG_TEST
doc.filename = "addImage_example.docx"

# set default font size to 10
options( "ReporteRs-fontsize" = 10 )

doc = docx( )
# the file 'logo.jpg' only exists in R for Windows
img.file = file.path( Sys.getenv("R_HOME"), "doc", "html", "logo.jpg" )
doc = addImage(doc, img.file )

# Write the object
writeDoc( doc, file = doc.filename )
#STOP_TAG_TEST
# }

Run the code above in your browser using DataCamp Workspace