A function to convert TableTree to .rtf
Usage
tt_to_tlgrtf(
tt,
file = NULL,
orientation = c("portrait", "landscape"),
colwidths = def_colwidths(tt, fontspec, col_gap = col_gap, label_width_ins =
label_width_ins, type = tlgtype),
label_width_ins = 2,
watermark = NULL,
pagenum = ifelse(tlgtype == "Listing", TRUE, FALSE),
fontspec = font_spec("Times", 9L, 1.2),
pg_width = pg_width_by_orient(orientation == "landscape"),
margins = c(0, 0, 0, 0),
paginate = tlg_type(tt) == "Table",
col_gap = ifelse(tlgtype == "Listing", 0.5, 3),
nosplitin = list(row = character(), col = character()),
verbose = FALSE,
tlgtype = tlg_type(tt),
string_map = default_str_map,
markup_df = dps_markup_df,
combined_rtf = FALSE,
one_table = TRUE,
border_mat = make_header_bordmat(obj = tt),
round_type = obj_round_type(tt),
alignments = list(),
validate = TRUE,
...
)Arguments
- tt
(
TableTree)
TableTree object to convert to RTF- file
(
character(1))
File to create, including path, but excluding .rtf extension.- orientation
(
character)
Orientation of the output ("portrait" or "landscape")- colwidths
(
numericvector)
Column widths for the table- label_width_ins
(
numeric)
Label width in inches- watermark
(optional) String containing the desired watermark for RTF outputs. Vectorized.
- pagenum
(
logical)
Whether to add page numbers to the output. Only applicable to listings (i.e. it is ignored for tables and figures).- fontspec
(
font_spec)
Font specification object- pg_width
(
numeric)
Page width in inches- margins
(
numericvector)
Margins in inches (top, right, bottom, left)- paginate
(
logical)
Whether to paginate the output- col_gap
(
numeric)
Column gap in spaces- nosplitin
(
list)
list(row=, col=). Path elements whose children should not be paginated within if it can be avoided. e.g., list(col="TRT01A") means don't split within treatment arms unless all the associated columns don't fit on a single page.- verbose
(
logical)
Whether to print verbose output- tlgtype
(
character)
Type of the output (Table, Listing, or Figure)- string_map
(
data.frame)
Unicode mapping for special characters- markup_df
(
data.frame)
Data frame containing markup information- combined_rtf
(
logical(1))
In the case where the result is broken up into multiple parts due to width, should a combined rtf file also be created. Defaults toFALSE.- one_table
(
logical(1))
Ifttis a (non-MatrixPrintForm) list, should the parts be added to the rtf within a single table (TRUE, the default) or as separate tables. End users will not generally need to set this.- border_mat
(
matrix)
Am x kmatrix where m is the number of columns ofttand k is the number of lines the header takes up. See tidytlg::add_bottom_borders for what the matrix should contain. Users should only specify this when the default behavior does not meet their needs.- round_type
(
character(1))
the type of rounding to perform. Seeformatters::format_value()for more details.- alignments
(
list)
List of named lists. Vectorized. (Default =list()) Used to specify individual column or cell alignments. Each named list containsrow,col, andvalue, which are passed tohuxtable::set_align()to set the alignments.- validate
logical(1). Whether to validate the table structure using
rtables::validate_table_struct(). Defaults toTRUE. IfFALSE, a message will be displayed when validation fails.- ...
Additional arguments passed to gentlg
Value
If file is non-NULL, this is called for the side-effect of writing
one or more RTF files. Otherwise, returns a list of huxtable objects.
Note
file should always include path. Path will be extracted
and passed separately to gentlg.
When one_table is FALSE, only the width of the row label
pseudocolumn can be directly controlled due to a limitation in
tidytlg::gentlg. The proportion of the full page that the first value
in colwidths would take up is preserved and all other columns equally
split the remaining available width. This will cause, e.g., the
elements within the allparts rtf generated when combined_rtf is TRUE
to differ visually from the content of the individual part rtfs.
