ReporteRs (version 0.8.8)

addCodeBlock: Add code block into a document object

Description

Add a code block into a document object

Usage

addCodeBlock(doc, file, text, ...)

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

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

Arguments

doc

document object

file

script file. Not used if text is provided.

text

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

...

further arguments passed to other methods

par.properties

code block paragraph properties. An object of class parProperties

text.properties

code block text properties. An object of class textProperties

bookmark

Only for docx. A character value ; id of the Word bookmark to replace by the script. optional.

append

Only for pptx. boolean default to FALSE. If TRUE, paragraphs will be appened in the current shape instead of beeing sent into a new shape. Paragraphs can only be appended on shape containing paragraphs (i.e. you can not add paragraphs after a FlexTable).

Value

a document object

See Also

docx, pptx

Examples

# NOT RUN {
cb <- "ls -a\nwhich -a ls"

options( "ReporteRs-fontsize" = 11 )

# }
# NOT RUN {
# docx example ---------
doc = docx( )
doc <- addCodeBlock( doc, text = cb )
writeDoc( doc, file = "ex_codeblock.docx" )
# }
# NOT RUN {
# }
# NOT RUN {
# pptx example ---------
doc = pptx( )
doc = addSlide( doc, slide.layout = "Title and Content" )
doc <- addCodeBlock( doc, text = cb )
writeDoc( doc, file = "ex_codeblock.pptx" )
# }