tab_styles
tab_styles.Rd
Define styles for different elements of the table.
Usage
tab_styles(
background_style = openxlsx::createStyle(fgFill = "#ffffff"),
hline_style = openxlsx::createStyle(border = "Top", borderColour =
openxlsx::openxlsx_getOp("borderColour", "black"), borderStyle =
openxlsx::openxlsx_getOp("borderStyle", "double")),
vline_style = openxlsx::createStyle(border = "Left", borderColour =
openxlsx::openxlsx_getOp("borderColour", "black"), borderStyle =
openxlsx::openxlsx_getOp("borderStyle", "double")),
title_style = openxlsx::createStyle(fontSize = 14, halign = "left", textDecoration =
"bold"),
subtitle_style = openxlsx::createStyle(fontSize = 11, halign = "left", textDecoration =
"bold"),
header_style = openxlsx::createStyle(fontSize = 11, halign = "center", border =
"BottomLeftRight", borderColour = openxlsx::openxlsx_getOp("borderColour", "black"),
borderStyle = openxlsx::openxlsx_getOp("borderStyle", "double"), textDecoration =
"bold"),
merge_rownames = TRUE,
merged_rownames_style = createStyle(valign = "top"),
footnote_style = openxlsx::createStyle(fontSize = 11, halign = "left"),
data_styles = create_data_styles(),
cell_styles = NULL
)
Arguments
- background_style
color etc. for the entire background of the table
- hline_style
style for the horizontal lines used in the table. Note: the style for the lines under spanners is defined in the title_style.
- vline_style
style for the vertical lines used in the table. Note: the style for the lines under spanners is defined in the title_style.
- title_style
style applied to the table title
- subtitle_style
style applied to the table subtitle
- header_style
style applied to the table header (column names)
- 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 colum (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.
Examples
tab_styles()
#> $background_style
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell fill foreground: rgb: #FFFFFF
#>
#>
#>
#> $hline_style
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell borders: Top: thin
#> Cell border colours: #000000
#>
#>
#>
#> $vline_style
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Cell borders: Left: thin
#> Cell border colours: #000000
#>
#>
#>
#> $title_style
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Font size: 14
#> Font decoration: BOLD
#> Cell horz. align: left
#>
#>
#>
#> $subtitle_style
#> A custom cell style.
#>
#> Cell formatting: GENERAL
#> Font size: 11
#> Font decoration: BOLD
#> Cell horz. align: left
#>
#>
#>
#> $header_style
#> 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
#>
#>
#>
#> $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
#>