body_add_title | R Documentation |
officer
documentAdd a title to an officer
document
body_add_title(
doc,
value,
level = 1,
squish = TRUE,
envir = parent.frame(),
style = getOption("crosstable_style_heading", "heading")
)
doc |
the doc object (created with the |
value |
a character string. See Section below for markdown support. |
level |
the level of the title. See |
squish |
Whether to squish the result (remove trailing and repeated spaces). Default to |
envir |
Environment to evaluate each expression in |
style |
the name of the title style. See |
The docx object doc
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.
Dan Chaltiel
library(officer)
library(crosstable)
library(dplyr)
doc = read_docx() %>%
body_add_title("La table iris (nrow={nrow(iris)})", 1) %>%
body_add_title("Description", 2) %>%
body_add_normal("La table iris a ", ncol(iris), " colonnes.")
#write_and_open(doc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.