diff --git a/DESCRIPTION b/DESCRIPTION index 110176cfd..9e79bfb41 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: openxlsx2 Title: Read, Write and Edit 'xlsx' Files -Version: 1.7.0.9000 +Version: 1.8 Language: en-US Authors@R: c( person("Jordan Mark", "Barbone", email = "jmbarbone@gmail.com", role = "aut", comment = c(ORCID = "0000-0001-9788-3628")), @@ -39,7 +39,7 @@ Suggests: VignetteBuilder: knitr Encoding: UTF-8 -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Roxygen: list(markdown = TRUE) Config/testthat/edition: 3 Config/testthat/parallel: true diff --git a/NEWS.md b/NEWS.md index 5144b61d9..7e89f6641 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,29 @@ -# openxlsx2 (development version) +# openxlsx2 1.8 -* Legacy `write_data()`, `write_datatable()`, `write_formula()`, `write_comment()` are now deprecated in favour of `wb_add_data()`, `wb_add_data_table()`, `wb_add_formula()`, and `wb_add_comment()`. +## Maintenance + +* Legacy `write_data()`, `write_datatable()`, `write_formula()`, `write_comment()` are now deprecated in favor of `wb_add_data()`, `wb_add_data_table()`, `wb_add_formula()`, and `wb_add_comment()`. ([1064](https://github.com/JanMarvin/openxlsx2/pull/1064), @olivroy). + +* `convertToExcelDate()` is defunct and will be removed in a future version of the package. Use `convert_to_excel_date()`. ([1064](https://github.com/JanMarvin/openxlsx2/pull/1064), @olivroy). + +## New features + +* `wb_dims()` is now able to handle various columns. [1019](https://github.com/JanMarvin/openxlsx2/pull/1019) + +* `wb_to_df()` now has a `check_names` argument. [1050](https://github.com/JanMarvin/openxlsx2/pull/1050) + +* The set of conditional formatting icon sets now includes x14 icons. This commit also fixed adding conditional formatting to worksheets with pivot tables. [1053](https://github.com/JanMarvin/openxlsx2/pull/1053) + +## Fixes + +* Many improvements in the `xlsb` parser. This includes changes to the logic of the formula parser, rich text strings are now handled, data validation, table formulas and various corrections all over the place. It is still lacking various features and this wont change in the foreseeable future, but the parser is now in better shape than ever. [1037](https://github.com/JanMarvin/openxlsx2/pull/1037), [1040](https://github.com/JanMarvin/openxlsx2/pull/1040), [1042](https://github.com/JanMarvin/openxlsx2/pull/1042), [1044](https://github.com/JanMarvin/openxlsx2/pull/1044), [1049](https://github.com/JanMarvin/openxlsx2/pull/1049), [1054](https://github.com/JanMarvin/openxlsx2/pull/1054) + +* `write_xlsx()` now uses `sheet`. Previously it required the undocumented `sheet_name`. [1057](https://github.com/JanMarvin/openxlsx2/pull/1057) + +* Fixed a bug were we obfuscated valid html in worksheets with vml buttons. These files previously did not load. [1062](https://github.com/JanMarvin/openxlsx2/pull/1062) + +* Fixed slow writing of non consecutive number formats introduced in the previous release. [1067](https://github.com/JanMarvin/openxlsx2/pull/1067), [1068](https://github.com/JanMarvin/openxlsx2/pull/1068) -* `convertToExcelDate()` is defunct and will be removed in a future version of the package. Use `convert_to_excel_date()`. *************************************************************************** diff --git a/R/utils.R b/R/utils.R index 81291eed3..121bd739f 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1238,17 +1238,25 @@ is_dims <- function(x) { } #' check if non consecutive dims is equal sized: "A1:A4,B1:B4" -get_dims <- function(dims, check = TRUE, cols = TRUE) { +#' @param dims dims +#' @param check check if all the same size +#' @param cols return columns index +#' @keywords internal +#' @noRd +get_dims <- function(dims, check = FALSE, cols = FALSE, rows = FALSE) { - rows <- unique( - lapply(dims, FUN = function(dim) { - dimensions <- strsplit(dim, ":")[[1]] - as.integer(gsub("[[:upper:]]", "", dimensions)) - }) - ) + if (check || rows) { + rows <- unique( + lapply(dims, FUN = function(dim) { + dimensions <- strsplit(dim, ":")[[1]] + as.integer(gsub("[[:upper:]]", "", dimensions)) + }) + ) + } - if (check) + if (check) { return(length(rows) == 1) + } if (cols) { cols <- unique( diff --git a/R/wb_functions.R b/R/wb_functions.R index f0c453fcb..829a9020c 100644 --- a/R/wb_functions.R +++ b/R/wb_functions.R @@ -32,10 +32,10 @@ dims_to_dataframe <- function(dims, fill = FALSE, empty_rm = FALSE) { # condition 1) contains dims separator, but all dims are of # equal size: "A1:A5,B1:B5" # condition 2) either "A1:B5" or separator, but unequal size or "A1:A2,A4:A6,B1:B5" - if (has_dim_sep && get_dims(dims)) { + if (has_dim_sep && get_dims(dims, check = TRUE)) { - full_rows <- get_dims(dims, check = FALSE, cols = FALSE) - full_cols <- sort(get_dims(dims, check = FALSE, cols = TRUE)) + full_rows <- get_dims(dims, rows = TRUE) + full_cols <- sort(get_dims(dims, cols = TRUE)) rows_out <- unlist(full_rows) cols_out <- int2col(full_cols) diff --git a/man/convert_date.Rd b/man/convert_date.Rd index 8380bc462..6e5159ff7 100644 --- a/man/convert_date.Rd +++ b/man/convert_date.Rd @@ -20,7 +20,8 @@ convert_hms(x) \item{...}{ Arguments passed on to \code{\link[base:as.Date]{base::as.Date.character}} \describe{ - \item{\code{format}}{\code{\link[base]{character}} string. If not specified, it will try + \item{\code{format}}{a \code{\link[base]{character}} string. If not specified when + converting from a character representation, it will try \code{tryFormats} one by one on the first non-\code{NA} element, and give an error if none works. Otherwise, the processing is via \code{\link[base]{strptime}()} whose help page describes available