From aee174fa4f5119888e9fbf23c50bd51e38e992d2 Mon Sep 17 00:00:00 2001 From: Dan Chaltiel Date: Fri, 29 Mar 2024 10:10:06 +0100 Subject: [PATCH] Add colwidth=all to add_footer_row() --- R/augment_rows.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/augment_rows.R b/R/augment_rows.R index 5cebda68..350200ac 100644 --- a/R/augment_rows.R +++ b/R/augment_rows.R @@ -704,7 +704,7 @@ add_header_row <- function(x, top = TRUE, values = character(0), colwidths = int #' @export #' @title Add footer labels #' -#' @description Add a row of new columns labels in footer part. +#' @description Add a row of new column labels in the footer part. #' Labels can be spanned along multiple columns, as merged cells. #' #' Labels are associated with a number of columns @@ -745,6 +745,7 @@ add_header_row <- function(x, top = TRUE, values = character(0), colwidths = int #' colwidths = c(3, 8), top = TRUE #' ) #' ft_1 +#' add_footer_row(ft_1, values="My tailor and baker are rich", top=FALSE, colwidths="all") #' #' ft_2 <- flextable(head(airquality)) #' ft_2 <- add_footer_row(ft_2, @@ -758,6 +759,7 @@ add_footer_row <- function(x, top = TRUE, values = character(0), colwidths = int stop(sprintf("Function `%s` supports only flextable objects.", "add_footer_row()")) } + if (colwidths == "all") colwidths <- length(x$col_keys) if (sum(colwidths) != length(x$col_keys)) { stop(sprintf( "`colwidths` argument specify room for %.0f columns but %.0f are expected.",