export_as_docx | R Documentation |
From a table, produce a self-contained word document or attach it to a template word
file (template_file
). This function is based on the tt_to_flextable()
transformer and
the officer
package.
export_as_docx(
tt,
file,
doc_metadata = NULL,
titles_as_header = FALSE,
footers_as_text = TRUE,
template_file = NULL,
section_properties = section_properties_default(),
...
)
section_properties_default(
page_size = c("letter", "A4"),
orientation = c("portrait", "landscape")
)
margins_potrait()
margins_landscape()
tt |
( |
file |
( |
doc_metadata |
( |
titles_as_header |
( |
footers_as_text |
( |
template_file |
( |
section_properties |
( |
... |
( |
page_size |
( |
orientation |
( |
section_properties_default()
: Helper function that defines standard portrait properties for tables.
margins_potrait()
: Helper function that defines standard portrait margins for tables.
margins_landscape()
: Helper function that defines standard landscape margins for tables.
export_as_docx()
has few customization options available. If you require specific formats and details,
we suggest that you use tt_to_flextable()
prior to export_as_docx
. Only the title_as_header
and
footer_as_text
parameters must be re-specified if the table is changed first using tt_to_flextable()
.
tt_to_flextable()
library(flextable)
lyt <- basic_table() %>%
split_cols_by("ARM") %>%
analyze(c("AGE", "BMRKR2", "COUNTRY"))
tbl <- build_table(lyt, ex_adsl)
# See how section_properties_portrait function is built for custom
tf <- tempfile(fileext = ".docx")
export_as_docx(tbl,
file = tf,
section_properties = section_properties_default(orientation = "landscape")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.