diff --git a/NEWS.md b/NEWS.md index 9bdad113d..d3ca5e148 100644 --- a/NEWS.md +++ b/NEWS.md @@ -17,6 +17,8 @@ * New set of function `wb_get_properties()`/`wb_set_properties()` to view and modify workbook properties. [782](https://github.com/JanMarvin/openxlsx2/pull/782) This was subsequently improved to handle more workbook properties like `company` and `manager`. ([799](https://github.com/JanMarvin/openxlsx2/pull/799), @olivroy) +* Basic (experimental) support to add slicers to pivot tables created by `openxlsx2`. [822](https://github.com/JanMarvin/openxlsx2/pull/822) + ## Fixes * Removing the worksheet that is the active tab does no longer result in warnings in spreadsheet software. [792](https://github.com/JanMarvin/openxlsx2/pull/792) diff --git a/R/class-workbook-wrappers.R b/R/class-workbook-wrappers.R index 1850b6dff..82dfc34d2 100644 --- a/R/class-workbook-wrappers.R +++ b/R/class-workbook-wrappers.R @@ -374,7 +374,7 @@ wb_add_pivot_table <- function( #' Add a slicer to a pivot table #' -#' Add a slicer to a previously created pivot table. +#' Add a slicer to a previously created pivot table. This function is still experimental and might be changed/improved in upcoming releases. #' #' @param wb A Workbook object containing a #' worksheet. #' @param x A `data.frame` that inherits the [`wb_data`][wb_data()] class. @@ -386,6 +386,8 @@ wb_add_pivot_table <- function( #' @family workbook wrappers #' @family worksheet content functions #' @details This assumes that the slicer variable initialization has happened before. Unfortunately, it is unlikely that we can guarantee this for loaded workbooks, and we *strictly* discourage users from attempting this. If the variable has not been initialized properly, this may cause the spreadsheet software to crash. +#' +#' For the time being, the slicer needs to be placed on the slide with the pivot table. #' @examples #' wb <- wb_workbook() %>% #' wb_add_worksheet() %>% wb_add_data(x = mtcars) diff --git a/man/wb_add_slicer.Rd b/man/wb_add_slicer.Rd index 72d9ae4f3..4e3e9be8c 100644 --- a/man/wb_add_slicer.Rd +++ b/man/wb_add_slicer.Rd @@ -30,10 +30,12 @@ wb_add_slicer( \item{params}{a list of parameters to modify pivot table creation} } \description{ -Add a slicer to a previously created pivot table. +Add a slicer to a previously created pivot table. This function is still experimental and might be changed/improved in upcoming releases. } \details{ This assumes that the slicer variable initialization has happened before. Unfortunately, it is unlikely that we can guarantee this for loaded workbooks, and we \emph{strictly} discourage users from attempting this. If the variable has not been initialized properly, this may cause the spreadsheet software to crash. + +For the time being, the slicer needs to be placed on the slide with the pivot table. } \examples{ wb <- wb_workbook() \%>\%