Description Usage Arguments Details Value See Also Examples
Add a title into a document object
1 2 3 4 5 6 7 |
doc |
document object |
value |
|
... |
further arguments passed to or from other methods.. |
level |
|
Function addTitle when used with docx object needs to know which style correspond to which title level (1 ; 1.1 ; 1.1.1 ; etc.). When a template is read, ReporteRs tries to guess what are the available styles (english, french, chinese, etc.). If styles for titles has not been detected you will see the following error when addTitle is being called:
You must defined title styles via map_title first.
As the error message points out, you have to call the function 'map_title' to indicate which available styles are meant to be used as title styles.
To add a title into a pptx object you only have to specify the text to use as title. There is no level concept.
a document object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Title example for MS Word -------
if( check_valid_java_version() ){
doc.filename = "ex_add_title.docx"
doc <- docx()
doc <- addTitle( doc, "Title example 1", level = 1 )
doc <- addTitle( doc, "Title example 2", level = 1 )
writeDoc( doc, file = doc.filename )
}
if( check_valid_java_version() ){
# Title example for PowerPoint -------
doc.filename = "ex_add_title.pptx"
doc <- pptx()
doc <- addSlide(doc, "Title and Content")
doc <- addTitle(doc, "Title example")
writeDoc( doc, file = doc.filename )
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.