R/gt.R

Defines functions polish_content_word.gt_group polish_content_word.gt_tbl

# word --------------------------------------------------------------------

#' @export
polish_content_word.gt_tbl <- function(x, inline = FALSE, keep_with_next = TRUE, autonum = TRUE, ..., error_call = current_env()) {
  polish_check_dots_empty(call = error_call)

  xml <- gt::as_word(x, keep_with_next = keep_with_next, autonum = autonum)
  as_xml_word(xml, error_call = error_call)
}

#' @export
polish_content_word.gt_group <- function(x, inline = FALSE, keep_with_next = TRUE, autonum = TRUE, ..., error_call = current_env()) {
  polish_check_dots_empty(call = error_call)

  xml_list <- list()
  for(i in 1:nrow(x$gt_tbls)){
    xml <- gt::as_word(grp_pull(x,i), keep_with_next = keep_with_next, autonum = autonum)
    xml_list[[length(xml_list)+1]] <- xml

    # Add empty line between the tables
    if(i<nrow(x$gt_tbls)){
      xml_list[[length(xml_list)+1]] <- "<w:p/>"
    }
  }
  as_xml_word(xml_list, error_call = error_call)
}

Try the polish package in your browser

Any scripts or data that you put into this service are public.

polish documentation built on June 3, 2026, 5:07 p.m.