From 7571e35d770811ce9deb1e45e607a0f6b71f6830 Mon Sep 17 00:00:00 2001 From: olivroy Date: Wed, 23 Aug 2023 16:46:56 -0400 Subject: [PATCH 1/3] fix indentation --- R/class-workbook-wrappers.R | 2 +- man/wb_add_pivot_table.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/class-workbook-wrappers.R b/R/class-workbook-wrappers.R index 924cefa78..95ebba898 100644 --- a/R/class-workbook-wrappers.R +++ b/R/class-workbook-wrappers.R @@ -315,7 +315,7 @@ wb_add_data_table <- function( #' #' wb <- wb %>% #' wb_add_pivot_table(df, dims = "A3", -#' filter = "am", rows = "cyl", cols = "gear", data = "disp" +#' filter = "am", rows = "cyl", cols = "gear", data = "disp" #' ) #' @family workbook wrappers #' @export diff --git a/man/wb_add_pivot_table.Rd b/man/wb_add_pivot_table.Rd index 4fd97e4da..e291cc82c 100644 --- a/man/wb_add_pivot_table.Rd +++ b/man/wb_add_pivot_table.Rd @@ -55,7 +55,7 @@ df <- wb_data(wb, sheet = 1) wb <- wb \%>\% wb_add_pivot_table(df, dims = "A3", - filter = "am", rows = "cyl", cols = "gear", data = "disp" + filter = "am", rows = "cyl", cols = "gear", data = "disp" ) } \seealso{ From 2d9948fdd69c99abcfb5bebad66a966abf4d05d7 Mon Sep 17 00:00:00 2001 From: olivroy Date: Wed, 23 Aug 2023 18:24:52 -0400 Subject: [PATCH 2/3] Tweak news --- NEWS.md | 59 ++++++++++++++++++++++++++++------------ R/openxlsx2-package.R | 4 +-- man/openxlsx2_options.Rd | 4 +-- 3 files changed, 45 insertions(+), 22 deletions(-) diff --git a/NEWS.md b/NEWS.md index a05a833e0..bf0c98775 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,33 +1,56 @@ # openxlsx2 (development version) -## Fixes +## Breaking changes + +* `wb_get_worksheet()`, `wb_ws()`, `wb_get_sheet_name()` are no longer exported. [735](https://github.com/JanMarvin/openxlsx2/pull/735) They never worked as expected. + * Use `wb_get_sheet_names()`, `wb_get_active_sheet()`, `wb_get_selected()` instead. + +* `wbChartSheet` is now internal ([760](https://github.com/JanMarvin/openxlsx2/pull/760), @olivroy) + +## Deprecated functions -* fix date1904 detection in `wb_to_df()`. Previous results from this somewhat rare file type were using a wrong timezone origin. -* corrections in vignettes -* fixes for loading workbooks with threaded comments -* fixes for loading workbooks with embeddings other than docx +These functions are no longer recommended. +They will continue to work for some time, but changing to newer functions is recommended. + +* `delete_data()` is deprecated in favour of `wb_remove_tables()` or `wb_clean_sheet()` +* `create_comment()` is deprecated in favour of `wb_comment()`. Note that while `wb_comment()` has some new defaults, the behavior of `create_comment()` has not changed. ([758](https://github.com/JanMarvin/openxlsx2/pull/758), @olivroy) ## New features -* provide solve argument for `wb_merge_cells()`. This allows to solve cell intersecting regions. [733](https://github.com/JanMarvin/openxlsx2/pull/733) +* `wb_comment()` is a new helper function to help create `wbComment` objects + It is very similar to `create_comment()`, with the following differences: + * `author` looks at `options("openxlsx2.creator")`; (`create_comment()` only used `sys.getenv("user")`) + * `visible` defaults to `FALSE` to account for modern spreadsheet software behavior. (`create_comment()`, it is `TRUE`). + * `width` and `height` must now be of length 1. (In `create_comment()`, the first element is taken, other are ignored.) -* `wb_add_comment(comment = "x")` no longer errors when a comment as a character vector no longer fails [758, @olivroy](https://github.com/JanMarvin/openxlsx2/pull/758) +* `wb_get_sheet_names()` gains a `escape` argument to allow special XML characters to be escaped. [252](https://github.com/JanMarvin/openxlsx2/issues/252) -## Breaking changes +* `wb_color()` now accepts hex colors with leading sharp (e.g. "#FFFFF") [728](https://github.com/JanMarvin/openxlsx2/pull/728). -* no longer exporting `wb_get_sheet_name()` -* deprecating `delete_data()` and minor improvements to `wb_clean_sheet()` -* removing `wb_get_worksheet()`, `wb_ws()`. These never worked as expected. -* `create_comment()` has been renamed `wb_comment()`. [758, @olivroy](https://github.com/JanMarvin/openxlsx2/pull/758) The default arguments however are changed: +* `wb_merge_cells()` gains a `solve` argument. This allows to solve cell intersecting regions. [733](https://github.com/JanMarvin/openxlsx2/pull/733) - * `author` looks at `options("openxlsx2.creator")` in `wb_comment()` compared to only `sys.getenv("user")` in `create_comment()` - * `visible` defaults to `FALSE` in `wb_comment()` to account for modern spreadsheet software behavior. - In `create_comment()`, it is `TRUE`. - * `width` and `height` must now be of length 1. (In `create_comment()`, the first element is taken, other are ignored.) +* `wb_add_comment(comment = "x")` no longer errors when a comment as a character vector no longer fails ([758](https://github.com/JanMarvin/openxlsx2/pull/758), @olivroy) + + +## Documentation improvement + +* Tweaks to documentation and vignettes to make them more consistent. + +## Fixes + +* `wb_to_df()` now handles `date1904` detection in . Previous results from this somewhat rare file type were using a wrong timezone origin. +* `wb_load()` handles more cases. + * With workbooks with threaded comments [731](https://github.com/JanMarvin/openxlsx2/issues/731) + * With workbooks with embeddings other than docx [732](https://github.com/JanMarvin/openxlsx2/pulls/732) + * with workbooks with long hyperlinks [753](https://github.com/JanMarvin/openxlsx2/issues/753) + +* `wb_load()` adds the `path` to the `wbWorkbook` object. [741](https://github.com/JanMarvin/openxlsx2/issues/741) +* `wb_set_header_footer()` now works with special characters [747](https://github.com/JanMarvin/openxlsx2/issues/747) ## Internal changes -* `wb_get_active_sheet()`, `wb_set_active_sheet()`, `wb_get_selected()` and `wb_set_selected()` are now wrapper functions. +* `wb_get_active_sheet()`, `wb_set_active_sheet()`, `wb_get_selected()` and `wb_set_selected()` are now wrapper functions. [735](https://github.com/JanMarvin/openxlsx2/pull/735) + *************************************************************************** @@ -60,7 +83,7 @@ * `wb_grid_lines()` for `wb_set_grid_lines()` * make `get_cell_refs()`, `get_date_origin()`, `guess_col_type()`, and `write_file()`, `dataframe_to_dims()`, `dims_to_dataframe()`, `wb_get_sheet_name()` internal functions - * make classes `styles_mgr()`, `wbSheetData`, `wbWorksheet`, `wbChartSheet`, `wbComment`, `wbHyperlink` internal + * make classes `styles_mgr()`, `wbSheetData`, `wbWorksheet`, `wbComment`, `wbHyperlink` internal ## New features diff --git a/R/openxlsx2-package.R b/R/openxlsx2-package.R index 9213a5924..7ad8f25f9 100644 --- a/R/openxlsx2-package.R +++ b/R/openxlsx2-package.R @@ -73,8 +73,8 @@ #' * `options("openxlsx2.orientation" = "portrait")` ## page orientation #' * `options("openxlsx2.sheet.default_name" = "Sheet")` #' * `options("openxlsx2.rightToLeft" = NULL)` -#' * `options("openxlsx2.soon_deprecated" = FALSE)` ## warn if using camelCase -#' * `options("openxlsx2.creator")` ## Default is Windows Username +#' * `options("openxlsx2.soon_deprecated" = FALSE)` ## Set to `TRUE` if you want a warning if using some functions deprecated recently in openxlsx2 +#' * `options("openxlsx2.creator")` ## A default name for the creator of comments or new `wbWorkbook` objects. #' #' @name openxlsx2_options NULL diff --git a/man/openxlsx2_options.Rd b/man/openxlsx2_options.Rd index f4acf366e..1f02573a8 100644 --- a/man/openxlsx2_options.Rd +++ b/man/openxlsx2_options.Rd @@ -17,7 +17,7 @@ The openxlsx2 package uses global options to simplify formatting: \item \code{options("openxlsx2.orientation" = "portrait")} ## page orientation \item \code{options("openxlsx2.sheet.default_name" = "Sheet")} \item \code{options("openxlsx2.rightToLeft" = NULL)} -\item \code{options("openxlsx2.soon_deprecated" = FALSE)} ## warn if using camelCase -\item \code{options("openxlsx2.creator")} ## Default is Windows Username +\item \code{options("openxlsx2.soon_deprecated" = FALSE)} ## Set to \code{TRUE} if you want a warning if using some functions deprecated recently in openxlsx2 +\item \code{options("openxlsx2.creator")} ## A default name for the creator of comments or new \code{wbWorkbook} objects. } } From 4b2cdca1f9c689deba398844dabb85363e8e93fc Mon Sep 17 00:00:00 2001 From: olivroy Date: Wed, 23 Aug 2023 18:57:43 -0400 Subject: [PATCH 3/3] Rename vignettes --- vignettes/conditional-formatting.Rmd | 4 ++-- vignettes/openxlsx2_charts_manual.Rmd | 4 ++-- vignettes/openxlsx2_formulas_manual.Rmd | 4 ++-- vignettes/openxlsx2_style_manual.Rmd | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/vignettes/conditional-formatting.Rmd b/vignettes/conditional-formatting.Rmd index 28a2f5d19..a6ef80a7a 100644 --- a/vignettes/conditional-formatting.Rmd +++ b/vignettes/conditional-formatting.Rmd @@ -1,8 +1,8 @@ --- -title: "Conditional Formatting" +title: "Add conditional formatting to a workbook" output: rmarkdown::html_vignette vignette: > - %\VignetteIndexEntry{Conditional Formatting} + %\VignetteIndexEntry{Add conditional formatting to a workbook} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- diff --git a/vignettes/openxlsx2_charts_manual.Rmd b/vignettes/openxlsx2_charts_manual.Rmd index 96ba6b29c..2dfd38611 100644 --- a/vignettes/openxlsx2_charts_manual.Rmd +++ b/vignettes/openxlsx2_charts_manual.Rmd @@ -1,8 +1,8 @@ --- -title: "openxlsx2 charts manual" +title: "Add charts to a workbook" output: rmarkdown::html_vignette vignette: > - %\VignetteIndexEntry{openxlsx2 charts manual} + %\VignetteIndexEntry{Add charts to a workbook} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- diff --git a/vignettes/openxlsx2_formulas_manual.Rmd b/vignettes/openxlsx2_formulas_manual.Rmd index bb041cde8..4d62fad73 100644 --- a/vignettes/openxlsx2_formulas_manual.Rmd +++ b/vignettes/openxlsx2_formulas_manual.Rmd @@ -1,8 +1,8 @@ --- -title: "openxlsx2 formulas manual" +title: "Add formulas to a workbook" output: rmarkdown::html_vignette vignette: > - %\VignetteIndexEntry{openxlsx2 formulas manual} + %\VignetteIndexEntry{Add formulas to a workbook} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- diff --git a/vignettes/openxlsx2_style_manual.Rmd b/vignettes/openxlsx2_style_manual.Rmd index f030be208..ce65a1860 100644 --- a/vignettes/openxlsx2_style_manual.Rmd +++ b/vignettes/openxlsx2_style_manual.Rmd @@ -1,8 +1,8 @@ --- -title: "openxlsx2 style manual" +title: "Add styling to a workbook" output: rmarkdown::html_vignette vignette: > - %\VignetteIndexEntry{openxlsx2 style manual} + %\VignetteIndexEntry{Add styling to a workbook} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} ---