flextable (version 0.5.11)

set_caption: set caption

Description

set caption value in flextable

Usage

set_caption(
  x,
  caption,
  autonum = NULL,
  style = "Table Caption",
  html_escape = TRUE
)

Arguments

x

flextable object

caption

caption value

autonum

an autonum representation. See run_autonum. This has only an effect when output is Word. If used, the caption is preceded by an auto-number sequence. In this case, the caption is preceded by an auto-number sequence that can be cross referenced.

style

caption paragraph style name. These names are available with function styles_info when output is Word; if HTML, a corresponding css class definition should exist.

html_escape

should HTML entities be escaped so that it can be safely included as text or an attribute value within an HTML document.

Examples

Run this code
# NOT RUN {
ftab <- flextable( head( iris ) )
ftab <- set_caption(ftab, "my caption")
ftab

library(officer)
autonum <- run_autonum(seq_id = "tab", bkm = "mtcars")
ftab <- flextable( head( mtcars ) )
ftab <- set_caption(ftab, caption = "mtcars data", autonum = autonum)
ftab
# }

Run the code above in your browser using DataLab