addCodeBlock: Add code block into a document object

Description Usage Arguments Value See Also Examples

View source: R/addCodeBlock.R

Description

Add a code block into a document object

Usage

1
2
3
4
5
6
7
8
9
addCodeBlock(doc, file, text, ...)

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

## S3 method for class '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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
cb <- "ls -a\nwhich -a ls"

options( "ReporteRs-fontsize" = 11 )


# docx example ---------
doc = docx( )
doc <- addCodeBlock( doc, text = cb )
writeDoc( doc, file = "ex_codeblock.docx" )



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

ReporteRs documentation built on April 1, 2018, 12:06 p.m.