addTitle

0th

Percentile

Add a title

Add a title into a document object

Usage
addTitle(doc, value, ...)

# S3 method for docx addTitle(doc, value, level = 1, ...)

# S3 method for pptx addTitle(doc, value, ...)

Arguments
doc

document object

value

"character" value to use as title text

...

further arguments passed to or from other methods..

level

"integer" positive value to use as heading level. 1 for title1, 2 for title2, etc. Default to 1.

Details

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.

Value

a document object

See Also

map_title

Aliases
  • addTitle
  • addTitle.docx
  • addTitle.pptx
Examples
# NOT RUN {
# Title example for MS Word -------
# }
# NOT RUN {
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 )
# }
# NOT RUN {
# 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 )
# }
Documentation reproduced from package ReporteRs, version 0.8.10, License: GPL-3

Community examples

Looks like there are no examples yet.