ReporteRs (version 0.7.9)

addDocument.docx: Add external document into a docx object

Description

Add external document into a docx object.

Usage

# S3 method for docx
addDocument(doc, filename, ...)

Arguments

doc

Object of class docx where external image has to be added

filename

"character" value, complete filename of the external file (a Word document with docx extension).

...

further arguments, not used.

Value

an object of class docx.

Details

The rendering of embedded documents is made by Word. ReporteRs does only copy the content of the external file in the document.

When adding an external docx file into a docx object, styles of the external file are imported into the docx object. If a style exists in the docx object, Word will use the style of the docx object.

See Also

docx, addDocument

Examples

Run this code
# NOT RUN {
#START_TAG_TEST
doc.filename = "addDocument_example.docx"
# set default font size to 10
options( "ReporteRs-fontsize" = 10 )

doc2embed = docx( )
img.file = file.path( Sys.getenv("R_HOME"), "doc", "html", "logo.jpg" )
doc2embed = addImage(doc2embed, img.file )
writeDoc( doc2embed, file = "external_file.docx" )

doc = docx( )
doc = addDocument( doc, filename = "external_file.docx" )

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

Run the code above in your browser using DataCamp Workspace