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_worksheetgrid_linesA logical. If
FALSE, the worksheet grid lines will be hidden.row_col_headersA logical. If
FALSE, the worksheet colname and rowname will be hidden.tab_colorColor of the sheet tab. A
wb_color(), a valid color (belonging togrDevices::colors()) or a valid hex color beginning with "#".zoomThe 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_footerCharacter vector of length 3 corresponding to positions left, center, right.
headerandfooterare used to default additional arguments. Settingeven,odd, orfirst, overridesheader/footer. UseNAto skip a position.visibleIf
FALSE, sheet is hidden else visible.has_drawingIf
TRUEprepare a drawing output (TODO does this work?)paper_sizeAn integer corresponding to a paper size. See
wb_page_setup()for details.orientationOne of "portrait" or "landscape"
hdpi,vdpiHorizontal 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 = NULLor ifn_sheetsis 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_createddefaults toSys.time()so must be set toNULLto 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 thecallargument 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