diff --git a/NAMESPACE b/NAMESPACE index 75c277754..443fd6d52 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -68,6 +68,7 @@ export(wb_add_worksheet) export(wb_clean_sheet) export(wb_clone_sheet_style) export(wb_clone_worksheet) +export(wb_color) export(wb_colour) export(wb_conditional_formatting) export(wb_data) diff --git a/R/class-color.R b/R/class-color.R index aeebfb3de..e45511415 100644 --- a/R/class-color.R +++ b/R/class-color.R @@ -1,5 +1,4 @@ - -#' Create a new hyperlink object +#' Create a new wbColour object #' @param name A name of a color known to R #' @param auto A boolean. #' @param indexed An indexed color values. @@ -35,4 +34,51 @@ wb_colour <- function( z } +#' @export +#' @rdname wbColour +#' @usage NULL +wb_color <- wb_colour + is_wbColour <- function(x) inherits(x, "wbColour") + +#' takes color and returns colour +#' @param ... ... +#' @returns named colour argument +#' @keywords internal +#' @noRd +standardise_color_names <- function(...) { + + got <- ...names() + # can be Colour or colour + got_colour <- which(grepl("color", tolower(got))) + + if (length(got_colour)) { + for (got_col in got_colour) { + colour <- got[got_col] + name_color <- stringi::stri_replace_all_fixed(colour, "olor", "olour", ) + value_color <- ...elt(got_col) + assign(name_color, value_color, parent.frame()) + } + } +} + +#' takes colour and returns color +#' @param ... ... +#' @returns named color argument +#' @keywords internal +#' @noRd +standardize_colour_names <- function(...) { + + got <- ...names() + # can be Colour or colour + got_colour <- which(grepl("colour", tolower(got))) + + if (length(got_colour)) { + for (got_col in got_colour) { + colour <- got[got_col] + name_color <- stringi::stri_replace_all_fixed(colour, "olour", "olor", ) + value_color <- ...elt(got_col) + assign(name_color, value_color, parent.frame()) + } + } +} diff --git a/R/class-workbook-wrappers.R b/R/class-workbook-wrappers.R index 68488b292..596123e57 100644 --- a/R/class-workbook-wrappers.R +++ b/R/class-workbook-wrappers.R @@ -354,6 +354,7 @@ wb_unmerge_cells <- function(wb, sheet = current_sheet(), rows = NULL, cols = NU #' @param zoom A numeric between 10 and 400. Worksheet zoom level as a #' percentage. #' @param visible If FALSE, sheet is hidden else visible. +#' @param ... ... #' @details After chartsheet creation a chart must be added to the sheet. #' Otherwise the chartsheet will break the workbook. #' @family workbook wrappers @@ -364,14 +365,16 @@ wb_add_chartsheet <- function( sheet = next_sheet(), tabColour = NULL, zoom = 100, - visible = c("true", "false", "hidden", "visible", "veryhidden") + visible = c("true", "false", "hidden", "visible", "veryhidden"), + ... ) { assert_workbook(wb) wb$clone()$add_chartsheet( sheet = sheet, tabColour = tabColour, zoom = zoom, - visible = visible + visible = visible, + ... = ... ) } @@ -401,6 +404,7 @@ wb_add_chartsheet <- function( #' options("openxlsx2.hdpi" = X) #' @param vdpi Vertical DPI. Can be set with options("openxlsx2.dpi" = X) or #' options("openxlsx2.vdpi" = X) +#' @param ... ... #' @details Headers and footers can contain special tags \itemize{ #' \item{**&\[Page\]**}{ Page number} \item{**&\[Pages\]**}{ Number of pages} #' \item{**&\[Date\]**}{ Current date} \item{**&\[Time\]**}{ Current time} @@ -473,7 +477,8 @@ wb_add_worksheet <- function( paperSize = getOption("openxlsx2.paperSize", default = 9), orientation = getOption("openxlsx2.orientation", default = "portrait"), hdpi = getOption("openxlsx2.hdpi", default = getOption("openxlsx2.dpi", default = 300)), - vdpi = getOption("openxlsx2.vdpi", default = getOption("openxlsx2.dpi", default = 300)) + vdpi = getOption("openxlsx2.vdpi", default = getOption("openxlsx2.dpi", default = 300)), + ... ) { assert_workbook(wb) wb$clone()$add_worksheet( @@ -492,7 +497,8 @@ wb_add_worksheet <- function( paperSize = paperSize, orientation = orientation, vdpi = vdpi, - hdpi = hdpi + hdpi = hdpi, + ... = ... ) } @@ -837,6 +843,7 @@ wb_remove_worksheet <- function(wb, sheet = current_sheet()) { #' @param fontSize font size #' @param fontColour font colour #' @param fontName Name of a font +#' @param ... ... #' @details The font name is not validated in anyway. Excel replaces unknown font names #' with Arial. Base font is black, size 11, Calibri. #' @export @@ -849,12 +856,19 @@ wb_remove_worksheet <- function(wb, sheet = current_sheet()) { #' #' wb$add_data("S1", iris) #' wb$add_data_table("S1", x = iris, startCol = 10) ## font colour does not affect tables -wb_set_base_font <- function(wb, fontSize = 11, fontColour = wb_colour(theme = "1"), fontName = "Calibri") { +wb_set_base_font <- function( + wb, + fontSize = 11, + fontColour = wb_colour(theme = "1"), + fontName = "Calibri", + ... +) { assert_workbook(wb) wb$clone()$set_base_font( fontSize = fontSize, fontColour = fontColour, - fontName = fontName + fontName = fontName, + ... = ... ) } @@ -2171,6 +2185,7 @@ wb_set_cell_style <- function(wb, sheet = current_sheet(), dims, style) { #' @param dims dimensions on the worksheet e.g. "A1", "A1:A5", "A1:H5" #' @param bottom_color,left_color,right_color,top_color,inner_hcolor,inner_vcolor a color, either something openxml knows or some RGB color #' @param left_border,right_border,top_border,bottom_border,inner_hgrid,inner_vgrid the border style, if NULL no border is drawn. See create_border for possible border styles +#' @param ... ... #' @seealso [create_border()] #' @examples #' wb <- wb_workbook() %>% wb_add_worksheet("S1") %>% wb_add_data("S1", mtcars) @@ -2207,7 +2222,8 @@ wb_add_border <- function( inner_hgrid = NULL, inner_hcolor = NULL, inner_vgrid = NULL, - inner_vcolor = NULL + inner_vcolor = NULL, + ... ) { assert_workbook(wb) wb$clone()$add_border( @@ -2224,7 +2240,8 @@ wb_add_border <- function( inner_hgrid = inner_hgrid, inner_hcolor = inner_hcolor, inner_vgrid = inner_vgrid, - inner_vcolor = inner_vcolor + inner_vcolor = inner_vcolor, + ... = ... ) } @@ -2244,6 +2261,7 @@ wb_add_border <- function( #' @param gradient_fill a gradient fill xml pattern. #' @param every_nth_col which col should be filled #' @param every_nth_row which row should be filled +#' @param ... ... #' @examples #' wb <- wb_workbook() %>% wb_add_worksheet("S1") %>% wb_add_data("S1", mtcars) #' wb <- wb %>% wb_add_fill("S1", dims = "D5:J23", color = wb_colour(hex = "FFFFFF00")) @@ -2273,7 +2291,8 @@ wb_add_fill <- function( pattern = "solid", gradient_fill = "", every_nth_col = 1, - every_nth_row = 1 + every_nth_row = 1, + ... ) { assert_workbook(wb) wb$clone()$add_fill( @@ -2283,7 +2302,8 @@ wb_add_fill <- function( pattern = pattern, gradient_fill = gradient_fill, every_nth_col = every_nth_col, - every_nth_row = every_nth_row + every_nth_row = every_nth_row, + ... = ... ) } @@ -2307,6 +2327,7 @@ wb_add_fill <- function( #' @param shadow shadow #' @param extend extend #' @param vertAlign vertical alignment +#' @param ... ... #' @examples #' wb <- wb_workbook() %>% wb_add_worksheet("S1") %>% wb_add_data("S1", mtcars) #' wb %>% wb_add_font("S1", "A1:K1", name = "Arial", color = wb_colour(theme = "4")) @@ -2332,7 +2353,8 @@ wb_add_font <- function( family = "", scheme = "", shadow = "", - vertAlign = "" + vertAlign = "", + ... ) { assert_workbook(wb) wb$clone()$add_font( @@ -2353,7 +2375,8 @@ wb_add_font <- function( family = family, scheme = scheme, shadow = shadow, - vertAlign = vertAlign + vertAlign = vertAlign, + ... = ... ) } diff --git a/R/class-workbook.R b/R/class-workbook.R index d0cd6ba84..fbeaf5903 100644 --- a/R/class-workbook.R +++ b/R/class-workbook.R @@ -331,12 +331,14 @@ wbWorkbook <- R6::R6Class( #' @param tabColour tabColour #' @param zoom zoom #' @param visible visible + #' @param ... ... #' @return The `wbWorkbook` object, invisibly add_chartsheet = function( sheet = next_sheet(), tabColour = NULL, zoom = 100, - visible = c("true", "false", "hidden", "visible", "veryhidden") + visible = c("true", "false", "hidden", "visible", "veryhidden"), + ... ) { visible <- tolower(as.character(visible)) visible <- match.arg(visible) @@ -379,6 +381,7 @@ wbWorkbook <- R6::R6Class( ) ) + standardise_color_names(...) if (!is.null(tabColour)) { if (is_wbColour(tabColour)) { tabColour <- as.character(tabColour) @@ -475,6 +478,7 @@ wbWorkbook <- R6::R6Class( #' @param orientation orientation #' @param hdpi hdpi #' @param vdpi vdpi + #' @param ... ... #' @return The `wbWorkbook` object, invisibly add_worksheet = function( sheet = next_sheet(), @@ -495,7 +499,8 @@ wbWorkbook <- R6::R6Class( paperSize = getOption("openxlsx2.paperSize", default = 9), orientation = getOption("openxlsx2.orientation", default = "portrait"), hdpi = getOption("openxlsx2.hdpi", default = getOption("openxlsx2.dpi", default = 300)), - vdpi = getOption("openxlsx2.vdpi", default = getOption("openxlsx2.dpi", default = 300)) + vdpi = getOption("openxlsx2.vdpi", default = getOption("openxlsx2.dpi", default = 300)), + ... ) { visible <- tolower(as.character(visible)) visible <- match.arg(visible) @@ -529,6 +534,7 @@ wbWorkbook <- R6::R6Class( msg <- c(msg, "gridLines must be a logical of length 1.") } + standardise_color_names(...) if (!is.null(tabColour)) { if (is_wbColour(tabColour)) { tabColour <- as.character(tabColour) @@ -2001,9 +2007,11 @@ wbWorkbook <- R6::R6Class( #' @param fontSize fontSize #' @param fontColour fontColour #' @param fontName fontName + #' @param ... ... #' @return The `wbWorkbook` object - set_base_font = function(fontSize = 11, fontColour = wb_colour(theme = "1"), fontName = "Calibri") { + set_base_font = function(fontSize = 11, fontColour = wb_colour(theme = "1"), fontName = "Calibri", ...) { if (fontSize < 0) stop("Invalid fontSize") + standardise_color_names(...) if (is.character(fontColour) && is.null(names(fontColour))) fontColour <- wb_colour(fontColour) self$styles_mgr$styles$fonts[[1]] <- create_font(sz = as.character(fontSize), color = fontColour, name = fontName) }, @@ -4791,6 +4799,7 @@ wbWorkbook <- R6::R6Class( #' @param dims dimensions on the worksheet e.g. "A1", "A1:A5", "A1:H5" #' @param bottom_color,left_color,right_color,top_color,inner_hcolor,inner_vcolor a color, either something openxml knows or some RGB color #' @param left_border,right_border,top_border,bottom_border,inner_hgrid,inner_vgrid the border style, if NULL no border is drawn. See create_border for possible border styles + #' @param ... ... #' @seealso create_border #' @examples #' @@ -4832,7 +4841,8 @@ wbWorkbook <- R6::R6Class( inner_hgrid = NULL, inner_hcolor = NULL, inner_vgrid = NULL, - inner_vcolor = NULL + inner_vcolor = NULL, + ... ) { # TODO merge styles and if a style is already present, only add the newly @@ -4841,6 +4851,8 @@ wbWorkbook <- R6::R6Class( # cc <- wb$worksheets[[sheet]]$sheet_data$cc # df_s <- as.data.frame(lapply(df, function(x) cc$c_s[cc$r %in% x])) + standardize_colour_names(...) + df <- dims_to_dataframe(dims, fill = TRUE) sheet <- private$get_sheet_index(sheet) @@ -5223,6 +5235,7 @@ wbWorkbook <- R6::R6Class( #' @param gradient_fill a gradient fill xml pattern. #' @param every_nth_col which col should be filled #' @param every_nth_row which row should be filled + #' @param ... ... #' @examples #' # example from the gradient fill manual page #' gradient_fill <- " @@ -5237,7 +5250,8 @@ wbWorkbook <- R6::R6Class( pattern = "solid", gradient_fill = "", every_nth_col = 1, - every_nth_row = 1 + every_nth_row = 1, + ... ) { sheet <- private$get_sheet_index(sheet) private$do_cell_init(sheet, dims) @@ -5254,6 +5268,8 @@ wbWorkbook <- R6::R6Class( cc <- cc[cc$r %in% dims, ] styles <- unique(cc[["c_s"]]) + standardize_colour_names(...) + for (style in styles) { dim <- cc[cc$c_s == style, "r"] @@ -5292,6 +5308,7 @@ wbWorkbook <- R6::R6Class( #' @param shadow shadow #' @param extend extend #' @param vertAlign vertical alignment + #' @param ... ... #' @examples #' wb <- wb_workbook()$add_worksheet("S1")$add_data("S1", mtcars) #' wb$add_font("S1", "A1:K1", name = "Arial", color = wb_colour(theme = "4")) @@ -5314,7 +5331,8 @@ wbWorkbook <- R6::R6Class( family = "", scheme = "", shadow = "", - vertAlign = "" + vertAlign = "", + ... ) { sheet <- private$get_sheet_index(sheet) private$do_cell_init(sheet, dims) @@ -5326,6 +5344,8 @@ wbWorkbook <- R6::R6Class( cc <- cc[cc$r %in% dims, ] styles <- unique(cc[["c_s"]]) + standardize_colour_names(...) + for (style in styles) { dim <- cc[cc$c_s == style, "r"] diff --git a/R/wb_styles.R b/R/wb_styles.R index 6a2ce6795..56e50e595 100644 --- a/R/wb_styles.R +++ b/R/wb_styles.R @@ -109,6 +109,7 @@ import_styles <- function(x) { #' @param top x #' @param top_color x #' @param vertical x +#' @param ... x #' #' @export create_border <- function( @@ -128,9 +129,12 @@ create_border <- function( start = "", top = NULL, top_color = NULL, - vertical = "" + vertical = "", + ... ) { + standardize_colour_names(...) + if (!is.null(left_color)) left_color <- xml_node_create("color", xml_attributes = left_color) if (!is.null(right_color)) right_color <- xml_node_create("color", xml_attributes = right_color) if (!is.null(top_color)) top_color <- xml_node_create("color", xml_attributes = top_color) @@ -202,6 +206,7 @@ create_numfmt <- function(numFmtId, formatCode) { #' @param sz font size: default "11", #' @param u underline #' @param vertAlign vertical alignment +#' @param ... ... #' @examples #' font <- create_font() #' # openxml has the alpha value leading @@ -227,9 +232,12 @@ create_font <- function( strike = "", sz = "11", u = "", - vertAlign = "" + vertAlign = "", + ... ) { + standardize_colour_names(...) + if (b != "") { b <- xml_node_create("b", xml_attributes = c("val" = b)) } @@ -323,15 +331,19 @@ create_font <- function( #' @param patternType various default is "none", but also "solid", or a color like "gray125" #' @param bgColor hex8 color with alpha, red, green, blue only for patternFill #' @param fgColor hex8 color with alpha, red, green, blue only for patternFill +#' @param ... ... #' #' @export create_fill <- function( gradientFill = "", patternType = "", bgColor = NULL, - fgColor = NULL + fgColor = NULL, + ... ) { + standardize_colour_names(...) + if (!is.null(bgColor) && all(bgColor != "")) { bgColor <- xml_node_create("bgColor", xml_attributes = bgColor) } @@ -698,6 +710,7 @@ set_cell_style <- function(wb, sheet, cell, value) { #' @param text_strike strikeout #' @param text_italic italic #' @param text_underline underline 1, true, single or double +#' @param ... ... #' @return A dxfs style node #' @seealso [wb_add_style()] #' @examples @@ -733,9 +746,12 @@ create_dxfs_style <- function( text_bold = NULL, text_strike = NULL, text_italic = NULL, - text_underline = NULL # "true" or "double" + text_underline = NULL, # "true" or "double" + ... ) { + standardize_colour_names(...) + if (is.null(font_color)) font_color <- "" if (is.null(font_size)) font_size <- "" if (is.null(text_bold)) text_bold <- "" diff --git a/R/write_xlsx.R b/R/write_xlsx.R index af5e8cec3..557326461 100644 --- a/R/write_xlsx.R +++ b/R/write_xlsx.R @@ -169,6 +169,8 @@ write_xlsx <- function(x, file, asTable = FALSE, ...) { tabColour <- NULL if ("tabColour" %in% names(params)) { tabColour <- params$tabColour + } else if ("tabColor" %in% names(params)) { + tabColour <- params$tabColor } zoom <- 100 diff --git a/man/create_border.Rd b/man/create_border.Rd index b1dbc2574..e394b7425 100644 --- a/man/create_border.Rd +++ b/man/create_border.Rd @@ -21,7 +21,8 @@ create_border( start = "", top = NULL, top_color = NULL, - vertical = "" + vertical = "", + ... ) } \arguments{ @@ -58,6 +59,8 @@ create_border( \item{top_color}{x} \item{vertical}{x} + +\item{...}{x} } \description{ Border styles can any of the following: "thin", "thick", "slantDashDot", "none", "mediumDashed", "mediumDashDot", "medium", "hair", "double", "dotted", "dashed", "dashedDotDot", "dashDot" diff --git a/man/create_dxfs_style.Rd b/man/create_dxfs_style.Rd index 3f7f1a78b..b1ad42493 100644 --- a/man/create_dxfs_style.Rd +++ b/man/create_dxfs_style.Rd @@ -16,7 +16,8 @@ create_dxfs_style( text_bold = NULL, text_strike = NULL, text_italic = NULL, - text_underline = NULL + text_underline = NULL, + ... ) } \arguments{ @@ -47,6 +48,8 @@ or one of colours(). If fontColour is NULL, the workbook base font colours is us \item{text_italic}{italic} \item{text_underline}{underline 1, true, single or double} + +\item{...}{...} } \value{ A dxfs style node diff --git a/man/create_fill.Rd b/man/create_fill.Rd index 004feb579..afdbce180 100644 --- a/man/create_fill.Rd +++ b/man/create_fill.Rd @@ -8,7 +8,8 @@ create_fill( gradientFill = "", patternType = "", bgColor = NULL, - fgColor = NULL + fgColor = NULL, + ... ) } \arguments{ @@ -19,6 +20,8 @@ create_fill( \item{bgColor}{hex8 color with alpha, red, green, blue only for patternFill} \item{fgColor}{hex8 color with alpha, red, green, blue only for patternFill} + +\item{...}{...} } \description{ create fill diff --git a/man/create_font.Rd b/man/create_font.Rd index 028898e04..044fe6ca9 100644 --- a/man/create_font.Rd +++ b/man/create_font.Rd @@ -19,7 +19,8 @@ create_font( strike = "", sz = "11", u = "", - vertAlign = "" + vertAlign = "", + ... ) } \arguments{ @@ -52,6 +53,8 @@ create_font( \item{u}{underline} \item{vertAlign}{vertical alignment} + +\item{...}{...} } \description{ create font format diff --git a/man/wbColour.Rd b/man/wbColour.Rd index 5aad58c24..9e5885bd6 100644 --- a/man/wbColour.Rd +++ b/man/wbColour.Rd @@ -2,7 +2,8 @@ % Please edit documentation in R/class-color.R \name{wb_colour} \alias{wb_colour} -\title{Create a new hyperlink object} +\alias{wb_color} +\title{Create a new wbColour object} \usage{ wb_colour( name = NULL, @@ -30,5 +31,5 @@ wb_colour( a \code{wbColour} object } \description{ -Create a new hyperlink object +Create a new wbColour object } diff --git a/man/wbWorkbook.Rd b/man/wbWorkbook.Rd index 22f827d8d..18e3b69c9 100644 --- a/man/wbWorkbook.Rd +++ b/man/wbWorkbook.Rd @@ -424,7 +424,8 @@ Add a chart sheet to the workbook sheet = next_sheet(), tabColour = NULL, zoom = 100, - visible = c("true", "false", "hidden", "visible", "veryhidden") + visible = c("true", "false", "hidden", "visible", "veryhidden"), + ... )}\if{html}{\out{}} } @@ -438,6 +439,8 @@ Add a chart sheet to the workbook \item{\code{zoom}}{zoom} \item{\code{visible}}{visible} + +\item{\code{...}}{...} } \if{html}{\out{}} } @@ -470,7 +473,8 @@ Add worksheet to the \code{wbWorkbook} object paperSize = getOption("openxlsx2.paperSize", default = 9), orientation = getOption("openxlsx2.orientation", default = "portrait"), hdpi = getOption("openxlsx2.hdpi", default = getOption("openxlsx2.dpi", default = 300)), - vdpi = getOption("openxlsx2.vdpi", default = getOption("openxlsx2.dpi", default = 300)) + vdpi = getOption("openxlsx2.vdpi", default = getOption("openxlsx2.dpi", default = 300)), + ... )}\if{html}{\out{}} } @@ -514,6 +518,8 @@ Add worksheet to the \code{wbWorkbook} object \item{\code{hdpi}}{hdpi} \item{\code{vdpi}}{vdpi} + +\item{\code{...}}{...} } \if{html}{\out{}} } @@ -859,7 +865,8 @@ Get the base font \if{html}{\out{
}}\preformatted{wbWorkbook$set_base_font( fontSize = 11, fontColour = wb_colour(theme = "1"), - fontName = "Calibri" + fontName = "Calibri", + ... )}\if{html}{\out{
}} } @@ -871,6 +878,8 @@ Get the base font \item{\code{fontColour}}{fontColour} \item{\code{fontName}}{fontName} + +\item{\code{...}}{...} } \if{html}{\out{}} } @@ -2228,7 +2237,8 @@ create borders for cell region inner_hgrid = NULL, inner_hcolor = NULL, inner_vgrid = NULL, - inner_vcolor = NULL + inner_vcolor = NULL, + ... )}\if{html}{\out{}} } @@ -2242,6 +2252,8 @@ create borders for cell region \item{\code{bottom_color, left_color, right_color, top_color, inner_hcolor, inner_vcolor}}{a color, either something openxml knows or some RGB color} \item{\code{left_border, right_border, top_border, bottom_border, inner_hgrid, inner_vgrid}}{the border style, if NULL no border is drawn. See create_border for possible border styles} + +\item{\code{...}}{...} } \if{html}{\out{}} } @@ -2293,7 +2305,8 @@ provide simple fill function pattern = "solid", gradient_fill = "", every_nth_col = 1, - every_nth_row = 1 + every_nth_row = 1, + ... )}\if{html}{\out{}} } @@ -2317,6 +2330,8 @@ provide simple fill function \item{\code{every_nth_col}}{which col should be filled} \item{\code{every_nth_row}}{which row should be filled} + +\item{\code{...}}{...} } \if{html}{\out{}} } @@ -2359,7 +2374,8 @@ provide simple font function family = "", scheme = "", shadow = "", - vertAlign = "" + vertAlign = "", + ... )}\if{html}{\out{}} } @@ -2399,6 +2415,8 @@ provide simple font function \item{\code{shadow}}{shadow} \item{\code{vertAlign}}{vertical alignment} + +\item{\code{...}}{...} } \if{html}{\out{}} } diff --git a/man/wb_add_border.Rd b/man/wb_add_border.Rd index 087801a73..2963ba996 100644 --- a/man/wb_add_border.Rd +++ b/man/wb_add_border.Rd @@ -19,7 +19,8 @@ wb_add_border( inner_hgrid = NULL, inner_hcolor = NULL, inner_vgrid = NULL, - inner_vcolor = NULL + inner_vcolor = NULL, + ... ) } \arguments{ @@ -32,6 +33,8 @@ wb_add_border( \item{bottom_color, left_color, right_color, top_color, inner_hcolor, inner_vcolor}{a color, either something openxml knows or some RGB color} \item{left_border, right_border, top_border, bottom_border, inner_hgrid, inner_vgrid}{the border style, if NULL no border is drawn. See create_border for possible border styles} + +\item{...}{...} } \description{ wb wrapper to create borders for cell region diff --git a/man/wb_add_chartsheet.Rd b/man/wb_add_chartsheet.Rd index 230bc089c..0796f2b59 100644 --- a/man/wb_add_chartsheet.Rd +++ b/man/wb_add_chartsheet.Rd @@ -9,7 +9,8 @@ wb_add_chartsheet( sheet = next_sheet(), tabColour = NULL, zoom = 100, - visible = c("true", "false", "hidden", "visible", "veryhidden") + visible = c("true", "false", "hidden", "visible", "veryhidden"), + ... ) } \arguments{ @@ -24,6 +25,8 @@ colours()) or a valid hex colour beginning with "#"} percentage.} \item{visible}{If FALSE, sheet is hidden else visible.} + +\item{...}{...} } \description{ Add a chartsheet to a workbook diff --git a/man/wb_add_fill.Rd b/man/wb_add_fill.Rd index 49d12a951..67f878c40 100644 --- a/man/wb_add_fill.Rd +++ b/man/wb_add_fill.Rd @@ -12,7 +12,8 @@ wb_add_fill( pattern = "solid", gradient_fill = "", every_nth_col = 1, - every_nth_row = 1 + every_nth_row = 1, + ... ) } \arguments{ @@ -35,6 +36,8 @@ wb_add_fill( \item{every_nth_col}{which col should be filled} \item{every_nth_row}{which row should be filled} + +\item{...}{...} } \value{ The \code{wbWorksheetObject}, invisibly diff --git a/man/wb_add_font.Rd b/man/wb_add_font.Rd index 45b272d95..00cfd9c34 100644 --- a/man/wb_add_font.Rd +++ b/man/wb_add_font.Rd @@ -22,7 +22,8 @@ wb_add_font( family = "", scheme = "", shadow = "", - vertAlign = "" + vertAlign = "", + ... ) } \arguments{ @@ -61,6 +62,8 @@ wb_add_font( \item{shadow}{shadow} \item{vertAlign}{vertical alignment} + +\item{...}{...} } \value{ The \code{wbWorksheetObject}, invisibly diff --git a/man/wb_add_worksheet.Rd b/man/wb_add_worksheet.Rd index 9bdcbb4e6..28ba240f2 100644 --- a/man/wb_add_worksheet.Rd +++ b/man/wb_add_worksheet.Rd @@ -24,7 +24,8 @@ wb_add_worksheet( paperSize = getOption("openxlsx2.paperSize", default = 9), orientation = getOption("openxlsx2.orientation", default = "portrait"), hdpi = getOption("openxlsx2.hdpi", default = getOption("openxlsx2.dpi", default = 300)), - vdpi = getOption("openxlsx2.vdpi", default = getOption("openxlsx2.dpi", default = 300)) + vdpi = getOption("openxlsx2.vdpi", default = getOption("openxlsx2.dpi", default = 300)), + ... ) } \arguments{ @@ -63,6 +64,8 @@ options("openxlsx2.hdpi" = X)} \item{vdpi}{Vertical DPI. Can be set with options("openxlsx2.dpi" = X) or options("openxlsx2.vdpi" = X)} + +\item{...}{...} } \value{ The \link{wbWorkbook} object \code{wb} diff --git a/man/wb_modify_basefont.Rd b/man/wb_modify_basefont.Rd index 786d6ab92..2ab89c439 100644 --- a/man/wb_modify_basefont.Rd +++ b/man/wb_modify_basefont.Rd @@ -9,7 +9,8 @@ wb_set_base_font( wb, fontSize = 11, fontColour = wb_colour(theme = "1"), - fontName = "Calibri" + fontName = "Calibri", + ... ) } \arguments{ @@ -20,6 +21,8 @@ wb_set_base_font( \item{fontColour}{font colour} \item{fontName}{Name of a font} + +\item{...}{...} } \description{ Modify the default font for this workbook diff --git a/tests/testthat/test-class-color.R b/tests/testthat/test-class-color.R index 933810329..dbb9df181 100644 --- a/tests/testthat/test-class-color.R +++ b/tests/testthat/test-class-color.R @@ -27,3 +27,34 @@ test_that("tabColour can be wb_colour()", { add_chartsheet(tabColour = "green") ) }) + +test_that("treat color and colour equally", { + + wb_color <- wb_workbook() %>% + wb_add_worksheet(tabColor = "green") %>% + wb_add_fill(color = wb_color("blue")) %>% + wb_add_border( + dims = "G12:H13", + left_color = wb_color("red"), + right_color = wb_color("blue"), + top_color = wb_color("green"), + bottom_color = wb_color("yellow") + ) + + wb_colour <- wb_workbook() %>% + wb_add_worksheet(tabColour = "green") %>% + wb_add_fill(colour = wb_colour("blue")) %>% + wb_add_border( + dims = "G12:H13", + left_colour = wb_colour("red"), + right_colour = wb_colour("blue"), + top_colour = wb_colour("green"), + bottom_colour = wb_colour("yellow") + ) + + expect_equal( + wb_color$styles_mgr$styles, + wb_colour$styles_mgr$styles + ) + +})