wb_add_flextable {flexlsx} | R Documentation |
Adds a flextable to an openxlsx2 workbook sheet
Description
Usage
wb_add_flextable(
wb,
sheet,
ft,
start_col = 1,
start_row = 1,
offset_caption_rows = 0L,
dims = NULL
)
Arguments
wb |
an openxlsx2 workbook |
sheet |
an openxlsx2 workbook sheet |
ft |
a flextable |
start_col |
a vector specifying the starting column to write to. |
start_row |
a vector specifying the starting row to write to. |
offset_caption_rows |
number of rows to offset the caption by |
dims |
Spreadsheet dimensions that will determine start_col and start_row: "A1", "A1:B2", "A:B" |
Value
an openxlsx2 workbook
Examples
if(requireNamespace("flextable", quietly = TRUE)) {
# Create a flextable
ft <- flextable::as_flextable(table(mtcars[,c("am","cyl")]))
# Create a workbook
wb <- openxlsx2::wb_workbook()$add_worksheet("mtcars")
# Add flextable to workbook
wb <- wb_add_flextable(wb, "mtcars", ft)
# Workbook can now be saved wb$save(),
# opened wb$open() - or removed
rm(wb)
}
[Package flexlsx version 0.2.1 Index]