`xl_rich_string()` builds the value of a single cell out of differently formatted runs, so that one cell can read "This is **bold** text". Pass it as the `value` of [xl_cell_general()].
Excel requires at least two runs: a string with one format is an ordinary character value, so pass it as one.
See also
[xl_rich_run], [xl_cell_general], [xl_font]
Other cell content:
is_xl_comment(),
xl_cell_general(),
xl_comment(),
xl_formula(),
xl_rich_run()
Examples
xl_rich_string("This is ", xl_rich_run("bold", xl_font(bold = TRUE)), " text")
#> <xl_rich_string: 3 runs>
#> "This is "
#> "bold" <formatted>
#> " text"
# in a cell, with a cell-wide format alongside the per-run fonts
xl_cell_general(
value = xl_rich_string("2 H", xl_rich_run("2", xl_font(script = "sub")), "O"),
format = xl_align(horizontal = "center")
)
#> [xl_cell_general: 1 cell]
#> [1] value=2 H2O, format=<set>
