Add a table into an rdocx object.
body_add_table(
x,
value,
style = NULL,
pos = "after",
header = TRUE,
alignment = NULL,
align_table = "center",
stylenames = table_stylenames(),
first_row = TRUE,
first_column = FALSE,
last_row = FALSE,
last_column = FALSE,
no_hband = FALSE,
no_vband = TRUE
)
a docx device
a data.frame to add as a table
table style
where to add the new element relative to the cursor, one of after", "before", "on".
display header if TRUE
columns alignement, argument length must match with columns length, values must be "l" (left), "r" (right) or "c" (center).
table alignment within document, value must be "left", "center" or "right"
columns styles defined by table_stylenames()
Specifies that the first column conditional formatting should be applied. Details for this and other conditional formatting options can be found at http://officeopenxml.com/WPtblLook.php.
Specifies that the first column conditional formatting should be applied.
Specifies that the first column conditional formatting should be applied.
Specifies that the first column conditional formatting should be applied.
Specifies that the first column conditional formatting should be applied.
Specifies that the first column conditional formatting should be applied.
Other functions for adding content:
body_add_blocks()
,
body_add_break()
,
body_add_caption()
,
body_add_docx()
,
body_add_fpar()
,
body_add_gg()
,
body_add_img()
,
body_add_par()
,
body_add_plot()
,
body_add_toc()
doc <- read_docx()
doc <- body_add_table(doc, iris, style = "table_template")
print(doc, target = tempfile(fileext = ".docx"))
Run the code above in your browser using DataLab