View source: R/ooxml_block_objects.R
table_stylenames | R Documentation |
The function defines the paragraph styles for columns.
table_stylenames(stylenames = list())
stylenames |
a named character vector, names are column names, values are paragraph styles associated with each column. If a column is not specified, default value 'Normal' is used. Another form is as a named list, the list names are the styles and the contents are column names to be formatted with the corresponding style. |
Other functions for table definition:
prop_table()
,
table_colwidths()
,
table_conditional_formatting()
,
table_layout()
,
table_width()
library(officer)
stylenames <- c(
vs = "centered", am = "centered",
gear = "centered", carb = "centered"
)
doc_1 <- read_docx()
doc_1 <- body_add_table(doc_1,
value = mtcars, style = "table_template",
stylenames = table_stylenames(stylenames = stylenames)
)
print(doc_1, target = tempfile(fileext = ".docx"))
stylenames <- list(
"centered" = c("vs", "am", "gear", "carb")
)
doc_2 <- read_docx()
doc_2 <- body_add_table(doc_2,
value = mtcars, style = "table_template",
stylenames = table_stylenames(stylenames = stylenames)
)
print(doc_2, target = tempfile(fileext = ".docx"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.