Generic function to add or update style definitions. Dispatches to class-specific methods, allowing different spec classes to implement their own style handling.
Arguments
- spec
Spec object (dispatches on class)
- id
Style identifier (auto-generated if NULL)
- ...
Style modifiers created with s_* functions
s_font— font properties.s_paragraph— paragraph-level formatting (may include nesteds_spacingands_indents).s_table_style— table-cell styling (may include nesteds_borders/s_border).
Details
Define styling for various document elements. Multiple calls to the same modifier function will merge with last-win strategy.
Available modifiers inside this function:
s_font- Font propertiess_paragraph- Paragraph formattings_table_style- Table cell styling
Examples
if (FALSE) { # \dontrun{
spec <- create_text() |>
add_style(id = "header",
s_font(font_name = "Arial", font_size = "14pt", bold = TRUE),
s_paragraph(alignment = "center"),
s_table_style(background_color = "#D9D9D9")
) |>
# Multiple calls merge with last-win
add_style(id = "header",
s_font(color = "#FF0000") # Adds color, keeps other font properties
)
} # }