Description Usage Arguments Value See Also Examples
Add a code block into a document object
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, ...)
|
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 |
text.properties |
code block text properties.
An object of class |
bookmark |
Only for |
append |
Only for |
a document object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | cb <- "ls -a\nwhich -a ls"
options( "ReporteRs-fontsize" = 11 )
if( check_valid_java_version() ){
# docx example ---------
doc = docx( )
doc <- addCodeBlock( doc, text = cb )
writeDoc( doc, file = "ex_codeblock.docx" )
}
if( check_valid_java_version() ){
# pptx example ---------
doc = pptx( )
doc = addSlide( doc, slide.layout = "Title and Content" )
doc <- addCodeBlock( doc, text = cb )
writeDoc( doc, file = "ex_codeblock.pptx" )
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.