Add a title to an officer
document
Usage
body_add_title(
doc,
value,
level = 1,
squish = TRUE,
style = getOption("crosstable_style_heading", "heading")
)
Arguments
- doc
the doc object (created with the
read_docx
function ofofficer
package)- value
a character string. See Section below for markdown support.
- level
the level of the title. See
styles_info(doc)
to know the possibilities.- squish
Whether to squish the result (remove trailing and repeated spaces). Default to
TRUE
.- style
the name of the title style. See
styles_info(doc)
to know the possibilities.
Markdown support
In all crosstable
helpers for officer
, you can use the following Markdown syntax to format your text:
bold:
"**text in bold**"
*italics:
"*text in italics*"
subscript:
"Text in ~subscript~"
superscript:
"Text in ^superscript^"
newline:
Before <br> After
color:
"<color:red>red text</color>"
shade:
"<shade:yellow>yellow text</shade>"
(background color)font family:
"<ff:symbol>symbol</ff>"
(
Note that the font name depends on your system language. For instant, in French, it would be Symbol
with an uppercase first letter.
See the last example of body_add_normal()
for a practical case.