The openxlsx2 package allows the user to set global options to simplify formatting:
If the built-in defaults don't suit you, set one or more of these options.
Typically, this is done in the .Rprofile
startup file
options("openxlsx2.borderColor" = "black")
options("openxlsx2.borderStyle" = "thin")
options("openxlsx2.dateFormat" = "mm/dd/yyyy")
options("openxlsx2.datetimeFormat" = "yyyy-mm-dd hh:mm:ss")
options("openxlsx2.maxWidth" = NULL)
(Maximum width allowed in Excel is 250)options("openxlsx2.minWidth" = NULL)
options("openxlsx2.numFmt" = NULL)
options("openxlsx2.paperSize" = 9)
corresponds to a A4 paper sizeoptions("openxlsx2.orientation" = "portrait")
page orientationoptions("openxlsx2.sheet.default_name" = "Sheet")
options("openxlsx2.rightToLeft" = NULL)
options("openxlsx2.soon_deprecated" = FALSE)
Set toTRUE
if you want a warning if using some functions deprecated recently in openxlsx2options("openxlsx2.creator")
A default name for the creator of newwbWorkbook
object withwb_workbook()
or new comments withwb_add_comment()
options("openxlsx2.thread_id")
the default person id when adding a threaded comment to a cell withwb_add_thread()
options("openxlsx2.accountingFormat" = 4)
options("openxlsx2.currencyFormat" = 4)
options("openxlsx2.commaFormat" = 3)
options("openxlsx2.percentageFormat" = 10)
options("openxlsx2.scientificFormat" = 48)
options("openxlsx2.string_nums" = TRUE)
numerics in character columns will be converted."1"
will be written as1
options("openxlsx2.na.strings" = "#N/A")
consulted bywrite_xlsx()
,wb_add_data()
andwb_add_data_table()
.options("openxlsx2.compression_level" = 6)
compression level for the output file. Increasing compression and time consumed from 1-9.