ReporteRs (version 0.1)

declareTitlesStyles.docx: Set manually headers'styles of a docx object

Description

Set manually headers'styles of a docx object

Usage

# S3 method for docx
declareTitlesStyles (doc, stylenames, ...)

Arguments

doc

docx object to be used with declareTitlesStyles.

stylenames

existing styles (character vector) where first element represents the style to use for title 1, second element represents the style to use for title 2, etc.

...

further arguments, not used.

Details

Function addTitle need to know which styles are corresponding to which title level (1 ; 1.1 ; 1.1.1 ; etc.). When template is read, function docx try to guess what are theses styles. If he do not succeed, an error occured saying 'You must defined header styles via declareTitlesStyles first.'. In that case, run styles(...) to see what are available styles, then declareTitlesStyles to indicate which available styles are meant to be used as header styles.

See Also

docx,styles.docx,addTitle.docx ,declareTitlesStyles

Examples

Run this code
# NOT RUN {
doc <- docx( title = "My example" )
styles( doc )
# [1] "Normal"                  "Title1"                  "Title2"
# [4] "Title3"                  "Title4"                  "Title5"
# [7] "Title6"                  "Title7"                  "Title8"
#[10] "Title9"                  "Defaut"                  ...
doc = declareTitlesStyles(doc
	, stylenames = c("Title1", "Title2", "Title3"
	, "Title4", "Title5", "Title6", "Title7", "Title8", "Title9" ) )
doc = addTitle( doc, "title 1", 1 )
# }

Run the code above in your browser using DataCamp Workspace