Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add colwidth=all to add_footer_row() #620

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion R/augment_rows.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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.",
Expand Down
Loading