xls_theme_default | R Documentation |
This function is a wrapper around [xls_theme()] that creates an xls theme for styling exported tables. It defines a theme whith sensible default formatting values. It also defines custom styles for "number", "decimal" and "percent column types. All its arguments must be 'openxlsx' Style objects.
xls_theme_default(
title = openxlsx::createStyle(fontSize = 16, textDecoration = "bold"),
footnote1 = openxlsx::createStyle(fontSize = 12),
footnote2 = openxlsx::createStyle(fontSize = 12),
footnote3 = openxlsx::createStyle(fontSize = 12),
col_header = openxlsx::createStyle(fontSize = 12, textDecoration = "bold", border =
c("top", "bottom", "left", "right"), borderStyle = "thin", wrapText = TRUE, halign =
"center"),
character = openxlsx::createStyle(fontSize = 12, border = c("top", "bottom", "left",
"right"), borderStyle = "thin"),
number = openxlsx::createStyle(fontSize = 12, numFmt = "### ### ### ##0", border =
c("top", "bottom", "left", "right"), borderStyle = "thin"),
decimal = openxlsx::createStyle(fontSize = 12, numFmt = "### ### ### ##0.0", border =
c("top", "bottom", "left", "right"), borderStyle = "thin"),
percent = openxlsx::createStyle(fontSize = 12, numFmt = "#0.0", border = c("top",
"bottom", "left", "right"), borderStyle = "thin", halign = "center"),
mergedcell = openxlsx::createStyle(fontSize = 12, border = c("top", "bottom", "left",
"right"), borderStyle = "thin", wrapText = TRUE, valign = "center", halign =
"center"),
...
)
title |
Style for the title |
footnote1 |
Style for footnote1 |
footnote2 |
Style for footnote2 |
footnote3 |
Style for footnote3 |
col_header |
Style for the columns header |
character |
Default style for data cells |
number |
Style for columns in number format |
decimal |
Style for columns in decimal format |
percent |
Style for columns in percent format |
mergedcell |
Style for merged cells |
... |
Other (named) custom styles |
a named list of class xls_theme, whose elements are 'openxlsx' Style objects.
xls_theme()
,
xls_theme_plain()
# default theme
xls_theme_default()
# default theme with title in italic
my_theme <- xls_theme_default(title = openxlsx::createStyle(textDecoration = "italic"))
## Not run:
toxlsx(object = iris, path = tempdir(), theme = my_theme)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.