View source: R/class-workbook-wrappers.R
| wb_add_dxfs_style | R Documentation |
The wb_add_dxfs_style() function defines a "Differential Formatting" (DXF)
style within a wbWorkbook. Unlike standard styles (XFs), which are assigned
directly to cells, DXF styles are used as templates for dynamic formatting
features such as conditional formatting rules and custom table styles.
wb_add_dxfs_style(
wb,
name,
font_name = NULL,
font_size = NULL,
font_color = NULL,
num_fmt = NULL,
border = NULL,
border_color = wb_color(getOption("openxlsx2.borderColor", "black")),
border_style = getOption("openxlsx2.borderStyle", "thin"),
bg_fill = NULL,
gradient_fill = NULL,
text_bold = NULL,
text_italic = NULL,
text_underline = NULL,
...
)
wb |
A wbWorkbook object. |
name |
A unique character string to identify the DXF style. |
font_name |
Character; the font name. |
font_size |
Numeric; the font size. |
font_color |
A |
num_fmt |
The number format string or ID. |
border |
Logical; if |
border_color |
A |
border_style |
Character; the border style (e.g., "thin", "thick"). Defaults to the "openxlsx2.borderStyle" option. |
bg_fill |
A |
gradient_fill |
An optional XML string for a gradient fill pattern. |
text_bold |
Logical; if |
text_italic |
Logical; if |
text_underline |
Logical; if |
... |
Additional arguments passed to |
DXF styles are differential because they usually only define a subset of cell properties (e.g., just the font color or a background fill). When a conditional formatting rule is triggered, the properties defined in the DXF style are layered on top of the cell's existing base style.
This function acts as a wrapper around create_dxfs_style(), allowing you
to bundle font, border, fill, and number format attributes into a named
style that can be referenced later by its name.
The wbWorkbook object, invisibly.
Other workbook styling functions:
base_font-wb,
wb_add_style(),
wb_base_colors
wb <- wb_workbook()
wb <- wb_add_worksheet(wb)
wb <- wb_add_dxfs_style(
wb,
name = "nay",
font_color = wb_color(hex = "FF9C0006"),
bg_fill = wb_color(hex = "FFFFC7CE")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.