officer (version 0.2.2)

body_add_docx: insert an external docx

Description

add content of a docx into an rdocx object.

Usage

body_add_docx(x, src, pos = "after")

Arguments

x

an rdocx object

src

docx filename

pos

where to add the new element relative to the cursor, one of "after", "before", "on".

Examples

Run this code
# NOT RUN {
img.file <- file.path( R.home("doc"), "html", "logo.jpg" )
if( file.exists(img.file) ){
  # create a example file to be inserted later in the final doc----
  doc <- read_docx()
  doc <- body_add_img(x = doc, src = img.file, height = 1.06, width = 1.39 )
  print(doc, target = "external_file.docx")

  # insert external_file.docx in the final doc----
  final_doc <- read_docx()
  doc <- body_add_docx(x = doc, src = "external_file.docx" )
  print(doc, target = "final.docx")
}

# }

Run the code above in your browser using DataCamp Workspace