ReporteRs (version 0.8.6)

addTitle: Add a title into a document object

Description

Add a title into a document object

Usage

addTitle(doc, value, ...)
"addTitle"(doc, value, level = 1, ...)
"addTitle"(doc, value, ...)
"addTitle"(doc, value, level = 1, id, ...)

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.
id
character single and unique value to use as title id when doc is bsdoc.

Value

a document object

Details

In MS Word, you can use whatever style you want as title formatting style. But to be considered as entries for a Table of Content, used styles must be 'title' styles. Theses are always available in MS Word list styles. When template is read, ReporteRs try to guess what are theses styles.

In MS PowerPoint, level can not be used as there is no associated level with a title in a slide.

See Also

docx, pptx, bsdoc

Examples

Run this code

# Title example for MS Word -------
doc.filename = "ex_add_title.docx"

options( "ReporteRs-fontsize" = 10 )
doc <- docx( )

doc = addTitle( doc, "Title example 1", level = 1 )

doc = addTitle( doc, "Title example 2", level = 1 )

writeDoc( doc, file = doc.filename )

# Title example for PowerPoint -------
doc.filename = "ex_add_title.pptx"

options( "ReporteRs-fontsize" = 24 )
doc = pptx( title = "title" )

# add a slide with layout "Title and Content"
doc = addSlide( doc, slide.layout = "Title and Content" )

doc = addTitle( doc, "Title example 1" )

writeDoc( doc, file = doc.filename )

# Title example for bsdoc -------
doc.filename = "ex_add_title/example.html"

options( "ReporteRs-fontsize" = 11 )
doc = bsdoc( )

doc = addTitle( doc, "Title example 1", level = 1 )

doc = addTitle( doc, "Title example 2", level = 1 )

writeDoc( doc, file = doc.filename )

Run the code above in your browser using DataLab