Skip to contents

Extends body_add_flextable() by adding:

Usage

body_add_flextable2(doc, x, bookmark = NULL, append_line = TRUE, ...)

Arguments

doc

An rdocx object from officer.

x

A flextable object. If it has a "legend" attribute, it is added.

bookmark

Optional. Word bookmark name for the legend.

append_line

Whether to add an empty line after the table.

...

Passed to flextable::body_add_flextable().

Value

The docx object doc

Examples

library(officer)
library(ggplot2)
ft = flextable::flextable(head(iris)) %>%
  structure(legend="The iris dataset")

doc = read_docx() %>%
 body_add_normal("Text before") %>%
 body_add_flextable2(ft) %>%
 body_add_normal("Text after")
write_and_open(doc)