Bundles table-wide formatting defaults – borders, alignment, bold, cell
padding, row height – into a single record that can be passed as the
style = argument of rtftable(). Each rtftable() call snapshots the
style fields it needs at construction time, so the style object behaves
like an immutable template.
Usage
rtf_table_style(
border_header = NULL,
border_spanning = NULL,
border_body = NULL,
border_first_row = NULL,
border_last_row = NULL,
header_align = NULL,
header_bold = FALSE,
header_italic = FALSE,
align = NULL,
bold = FALSE,
italic = FALSE,
underline = FALSE,
cell_padding_left_twips = NULL,
cell_padding_right_twips = NULL,
row_height_twips = NULL
)Arguments
- border_header, border_spanning, border_body, border_first_row, border_last_row
rtf_border()objects (orNULL) controlling each zone of the table.- header_align, header_bold, header_italic
Defaults for column-header row formatting.
header_align = NULLmeans "inheritalign".- align, bold, italic, underline
Defaults for data-row formatting.
align = NULL(the default) leaves each column's own default alone — row-title columns left, the others centred (seertftable()'srow_title);"left"/"center"/"right"sets every column.- cell_padding_left_twips, cell_padding_right_twips
Cell padding (twips) used by both column-header and data cells.
- row_height_twips
Row height (twips);
NULL= font-aware default.
Details
Use rtf_table_style_with() (or simply construct a fresh style) to
derive a variant.
Examples
tfl_style <- rtf_table_style(
border_header = rtf_border(top = TRUE, bottom = TRUE),
border_last_row = rtf_border(bottom = TRUE),
header_bold = FALSE,
header_align = NULL # inherit data alignment
)
dfs <- list(data.frame(Parameter = "Age", Value = "75.1"),
data.frame(Parameter = "Sex", Value = "53%"))
tbls <- lapply(dfs, function(df) rtftable(df, style = tfl_style))