rtf_fc_tables: Create RTF font and color tables

rtf_fc_tablesR Documentation

Create RTF font and color tables

Description

Create RTF font and color tables

Usage

rtf_fc_tables(..., extra_fonts = "Times", extra_colors = character(0))

Arguments

...

One or more objects of class huxtable.

extra_fonts

Extra fonts to include. These will be first in the fonts table.

extra_colors

Extra colors to include, as R color names.

Details

RTF documents have a single table of fonts, and a table of colors, in the RTF header. To create font and color tables for multiple huxtables, use this command. You can print the returned object in the RTF header. Pass it to print_rtf() or to_rtf() to ensure that huxtables print out the correct colour references.

Value

An object of class rtfFCTables. This is a list containing two items: "fonts" is a character vector of unique font names; "colors" is a character vector of unique color names.

Examples


# Printing multiple huxtables:

ht <- huxtable("Blue with red border")
ht <- set_all_borders(ht, 1)
ht <- set_all_border_colors(ht, "red")
background_color(ht) <- "blue"

ht2 <- huxtable("Dark green text")
text_color(ht2) <- "darkgreen"

fc_tbls <- rtf_fc_tables(ht, ht2)

# In the document header:
print(fc_tbls)

# In the document body:
print_rtf(ht, fc_tables = fc_tbls)
print_rtf(ht2, fc_tables = fc_tbls)

huxtable documentation built on Oct. 2, 2024, 1:06 a.m.