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" )
# bsdoc example ---------
doc = bsdoc( )
doc <- addCodeBlock( doc, text = cb )
writeDoc( doc, file = "ex_codeblock/example.html" )
# pptx example ---------
doc = pptx( )
doc = addSlide( doc, slide.layout = "Title and Content" )
doc <- addCodeBlock( doc, text = cb )
writeDoc( doc, file = "ex_codeblock.pptx" )
Run the code above in your browser using DataLab