This function is similar to openxlsx::writeData()
from the
package, but rather than just writing data.frames
,
write_worksheet()
supports specialized methods for the various
Tatoo_table
subclasses.
write_worksheet(
x,
wb,
sheet,
append = FALSE,
start_row = 1L,
...,
named_regions = TRUE,
named_regions_prefix = NA_character_
)# S3 method for Tagged_table
write_worksheet(
x,
wb,
sheet = sanitize_excel_sheet_names(attr(x, "meta")$table_id),
append = FALSE,
start_row = 1L,
...,
print_table_id = attr(x, "meta")[[".print_table_id"]],
named_regions = TRUE,
named_regions_prefix = NA_character_
)
# S3 method for Composite_table
write_worksheet(
x,
wb,
sheet,
append = FALSE,
start_row = 1L,
...,
named_regions = TRUE,
named_regions_prefix = NA_character_
)
# S3 method for Mashed_table
write_worksheet(
x,
wb,
sheet,
append = FALSE,
start_row = 1L,
mash_method = attr(x, "mash_method"),
id_vars = attr(x, "id_vars"),
insert_blank_row = attr(x, "insert_blank_row"),
sep_height = attr(x, "sep_height"),
...,
named_regions = TRUE,
named_regions_prefix = NA_character_
)
# S3 method for Stacked_table
write_worksheet(
x,
wb,
sheet,
append = FALSE,
start_row = 1L,
spacing = attr(x, "spacing"),
...,
named_regions = TRUE,
named_regions_prefix = NA_character_
)
an openxlsx Workbook object
A Tatoo_table
.
An openxlsx Workbook
object
The worksheet to write to. Can be the worksheet index or name.
logical
Whether or not to append to an existing worksheet or
create a new one
A scalar integer specifying the starting row to write to.
Additional arguments passed on to methods for overriding the
styling attributes of the Tatoo_tables
you want to export.
logical
. If TRUE
(default) named regions are created
in the target excel file to identify different parts of the tables
(header, body, column names, etc...). These named regions can, for example,
be used for applying formats. Creating named regions can be switched of
as this might impact performance of the excel conversion and writing of
excel files for workbooks with large numbers of tables.
character
scalar. Prefix to write in front
of all named regions created by write_worksheet
logical
vector. Whether or not table_id
should be
added to the title of the table. It is recommended to use table_ids only
internally (i.e. for walk_regions()
).
either "row"
or "col"
. Should the tables be mashed
together with alternating rows or with alternating columns?
If id_vars
is specified, the tables will be combined
using merge()
on the columns specified in id_vars
, otherwise
the tables will be combined with cbind()
.
Only if mashing rows: logical. Whether to insert blank rows between mash-groups. Warning: this converts all columns to character. Use with care.
Only has an effect when exporting to xlsx
. if
insert_blank_row == TRUE
, height of the inserted row, else height of the
top row of each mash-group.
Number of lineskips between the tables when exporting to xlsx
Other xlsx exporters:
as_workbook()