Define styles for different elements of the table.
Usage
tbl_styles(
bg_default = openxlsx::createStyle(fgFill = "#ffffff"),
bg_title = bg_default,
bg_subtitle = bg_default,
bg_header_lhs = bg_default,
bg_header_rhs = bg_default,
bg_rownames = bg_default,
bg_data = bg_default,
bg_footnote = bg_default,
vline = openxlsx::createStyle(border = "Left", borderColour = "#000000", borderStyle =
"thin"),
hline = openxlsx::createStyle(border = "Top", borderColour = "#000000", borderStyle =
"thin"),
cell_default = openxlsx::createStyle(fontSize = 11),
cell_title = openxlsx::createStyle(fontSize = 14, halign = "left", textDecoration =
"bold"),
cell_subtitle = openxlsx::createStyle(fontSize = 11, halign = "left", textDecoration =
"bold"),
cell_header_lhs = openxlsx::createStyle(fontSize = 11, halign = "center", border =
"BottomLeftRight", borderColour = "#000000", borderStyle = "thin", textDecoration =
"bold"),
cell_header_rhs = openxlsx::createStyle(fontSize = 11, halign = "center", border =
"BottomLeftRight", borderColour = "#000000", borderStyle = "thin", textDecoration =
"bold"),
cell_rownames = cell_default,
cell_data = cell_default,
cell_footnote = openxlsx::createStyle(fontSize = 11, halign = "left"),
merge_rownames = TRUE,
merged_rownames_style = openxlsx::createStyle(valign = "top"),
footnote_style = openxlsx::createStyle(fontSize = 11, halign = "left"),
data_styles = create_data_styles(),
cell_styles = NULL
)
Arguments
- bg_default
default color for the background of the table
- bg_title
background color for the title
- bg_subtitle
background color for the subtitle
- bg_header_lhs
background color for the left hand side of the table header
- bg_header_rhs
background color for the right hand side of the table header
- bg_rownames
background color for the row names
- bg_data
background color for the data
- bg_footnote
background color for the footnote
- vline
styling for all vertical lines added to the table
- hline
styling for all horizontal lines added to the table
- cell_default
default style added to cells in the table
- cell_title
style added to title cells in the table
- cell_subtitle
style added to subtitle cells in the table
- cell_header_lhs
style added to the left hand side of the header cells in the table
- cell_header_rhs
style added to the right hand side of the header cells in the table
- cell_rownames
style added to row name cells in the table
- cell_data
style added to data cells in the table
- cell_footnote
style added to footnote cells in the table
- merge_rownames
boolean: Should adjacent rows with identical names be merged?
- merged_rownames_style
style applied to the merged rownames
- footnote_style
style applied to the table footnote
- data_styles
styles applied to the columns in the data set based on their classes (e.g., numeric, character, etc.). data_styles must be a list of lists. Each inner list must have two elements: a "test" that is used to determine the class of a data column (e.g., is.double) and a style that is then applied to the columns where the test returns TRUE. Note that styles will be applied in the order of the list, meaning that a later style may overwrite an earlier style.
- cell_styles
an optional list with styles for selected cells in the data frame. See ?cell_style.
Examples
tbl_styles()
#> $bg_default
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell fill foreground: rgb: #FFFFFF
#>
#>
#>
#> $bg_title
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell fill foreground: rgb: #FFFFFF
#>
#>
#>
#> $bg_subtitle
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell fill foreground: rgb: #FFFFFF
#>
#>
#>
#> $bg_header_lhs
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell fill foreground: rgb: #FFFFFF
#>
#>
#>
#> $bg_header_rhs
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell fill foreground: rgb: #FFFFFF
#>
#>
#>
#> $bg_rownames
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell fill foreground: rgb: #FFFFFF
#>
#>
#>
#> $bg_data
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell fill foreground: rgb: #FFFFFF
#>
#>
#>
#> $bg_footnote
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell fill foreground: rgb: #FFFFFF
#>
#>
#>
#> $vline
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell borders: Left: thin
#> Cell border colours: #000000
#>
#>
#>
#> $hline
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell borders: Top: thin
#> Cell border colours: #000000
#>
#>
#>
#> $cell_default
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Font size: 11
#>
#>
#>
#> $cell_title
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Font size: 14
#> Font decoration: BOLD
#> Cell horz. align: left
#>
#>
#>
#> $cell_subtitle
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Font size: 11
#> Font decoration: BOLD
#> Cell horz. align: left
#>
#>
#>
#> $cell_header_lhs
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Font size: 11
#> Font decoration: BOLD
#> Cell borders: Bottom: thin, Left: thin, Right: thin
#> Cell border colours: #000000, #000000, #000000
#> Cell horz. align: center
#>
#>
#>
#> $cell_header_rhs
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Font size: 11
#> Font decoration: BOLD
#> Cell borders: Bottom: thin, Left: thin, Right: thin
#> Cell border colours: #000000, #000000, #000000
#> Cell horz. align: center
#>
#>
#>
#> $cell_rownames
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Font size: 11
#>
#>
#>
#> $cell_data
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Font size: 11
#>
#>
#>
#> $cell_footnote
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Font size: 11
#> Cell horz. align: left
#>
#>
#>
#> $merge_rownames
#> [1] TRUE
#>
#> $merged_rownames_style
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell vert. align: top
#>
#>
#>
#> $footnote_style
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Font size: 11
#> Cell horz. align: left
#>
#>
#>
#> $data_styles
#> $data_styles$double
#> $data_styles$double$test
#> function (x) .Primitive("is.double")
#>
#> $data_styles$double$style
#> A custom cell style.
#>
#> Cell formatting: "0.00"
#>
#>
#>
#>
#> $data_styles$integer
#> $data_styles$integer$test
#> function (x) .Primitive("is.integer")
#>
#> $data_styles$integer$style
#> A custom cell style.
#>
#> Cell formatting: "0"
#>
#>
#>
#>
#>
#> $cell_styles
#> NULL
#>