ReporteRs (version 0.8.2)

addCodeBlock.docx: Add a code block into a docx object

Description

Add a code block into a docx object.

Usage

# S3 method for docx
addCodeBlock(doc, file, text, par.properties = parProperties(),
  text.properties = textProperties(color = "#A7947D"), bookmark, ...)

Arguments

doc

Object of class docx

file

file. Not used if text is provided.

text

character vector. The text to parse. Not used if file is provided.

par.properties

code block paragraph properties. An object of class parProperties

text.properties

code block text properties. An object of class textProperties

bookmark

a character value ; id of the Word bookmark to replace by the script. optional. See bookmark.

...

further arguments, not used.

Value

an object of class docx.

Details

You have to one of the following argument: file or text or rscript.

See Also

docx, addCodeBlock

Examples

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

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

doc = docx( )
doc = addCodeBlock( doc, text = "ls -a\nwhich -a ls" )

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

Run the code above in your browser using DataCamp Workspace