wb_new_workbook()
is a convenience function wrapping
openxlsx2::wb_workbook()
and openxlsx2::wb_add_worksheet()
to offer quick
and easy setup for new workbooks.
Usage
wb_new_workbook(
sheet_names = NULL,
...,
default = "Sheet",
creator = NULL,
title = NULL,
subject = NULL,
category = NULL,
datetime_created = Sys.time(),
theme = NULL,
keywords = NULL,
properties = NULL,
call = caller_env()
)
Arguments
- sheet_names
Optional character vector of worksheet names.
- ...
Arguments passed on to
openxlsx2::wb_add_worksheet
grid_lines
A logical. If
FALSE
, the worksheet grid lines will be hidden.row_col_headers
A logical. If
FALSE
, the worksheet colname and rowname will be hidden.tab_color
Color of the sheet tab. A
wb_color()
, a valid color (belonging togrDevices::colors()
) or a valid hex color beginning with "#".zoom
The sheet zoom level, a numeric between 10 and 400 as a percentage. (A zoom value smaller than 10 will default to 10.)
header,odd_header,even_header,first_header,footer,odd_footer,even_footer,first_footer
Character vector of length 3 corresponding to positions left, center, right.
header
andfooter
are used to default additional arguments. Settingeven
,odd
, orfirst
, overridesheader
/footer
. UseNA
to skip a position.visible
If
FALSE
, sheet is hidden else visible.has_drawing
If
TRUE
prepare a drawing output (TODO does this work?)paper_size
An integer corresponding to a paper size. See
wb_page_setup()
for details.orientation
One of "portrait" or "landscape"
hdpi,vdpi
Horizontal and vertical DPI. Can be set with
options("openxlsx2.dpi" = X)
,options("openxlsx2.hdpi" = X)
oroptions("openxlsx2.vdpi" = X)
- default
Default prefix to use for numbered sheets. Default values are used if
sheet_names = NULL
or ifn_sheets
is greater than the length ofsheet_names
. Defaults to "Sheet".- creator
Creator of the workbook (your name). Defaults to login username or
options("openxlsx2.creator")
if set.- title, subject, category, keywords
Additional arguments passed to
openxlsx2::wb_workbook()
.- datetime_created
The time of the workbook is created
- theme
Optional theme identified by string or number. See Details for options.
- properties
A named list (typically from
openxlsx2::wb_get_properties()
) used to set new workbook properties for any values set toNULL
.datetime_created
defaults toSys.time()
so must be set toNULL
to inherit value fromproperties
.- call
The execution environment of a currently running function, e.g.
caller_env()
. The function will be mentioned in error messages as the source of the error. See thecall
argument ofabort()
for more information.
Examples
wb_new_workbook()
#> A Workbook object.
#>
#> Worksheets:
#> No worksheets attached
wb_new_workbook("Sheet 1")
#> A Workbook object.
#>
#> Worksheets:
#> Sheets: Sheet 1
#> Write order: 1
wb_new_workbook(c("Data", "Analysis"))
#> A Workbook object.
#>
#> Worksheets:
#> Sheets: Data, Analysis
#> Write order: 1, 2