xls_theme_default: Constructor function for the default xls theme

View source: R/themes.R

xls_theme_defaultR Documentation

Constructor function for the default xls theme

Description

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.

Usage

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"),
  ...
)

Arguments

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

Value

a named list of class xls_theme, whose elements are 'openxlsx' Style objects.

See Also

xls_theme(), xls_theme_plain()

Examples

# 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)

tablexlsx documentation built on Oct. 16, 2024, 5:08 p.m.