Skip to content

Commit

Permalink
Change output rtf section not to use an additional function.
Browse files Browse the repository at this point in the history
  • Loading branch information
fukuhiro2023 committed Aug 13, 2024
1 parent 20abdaf commit 5cd54dd
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions R/rtf_static_forestly.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,32 +197,17 @@ rtf_static_forestly <- function(
}

# Prepare output
rtf_output(outdata, path_outdata, path_outtable, doc_type = "figure")
}

#' Save outputs for RTF generation
#'
#' @param outdata An `outdata` object.
#' @param path_outdata A character string of file path to save the outdata.
#' @param pat_outtable A character string of file path to save the RTF table.
#'
#' @noRd
rtf_output <- function(
outdata,
path_outdata,
path_outtable,
doc_type = "table") {
if (!is.null(path_outdata)) {
save(outdata, file = path_outdata)
message("The outdata is saved in ", normalizePath(path_outdata))
}

if (!is.null(path_outtable)) {
outdata$rtf |>
r2rtf::rtf_encode(doc_type = doc_type) |>
r2rtf::rtf_encode(doc_type = "figure") |>
r2rtf::write_rtf(file = path_outtable)
message("The output is saved in ", normalizePath(path_outtable))
}

invisible(outdata)
}
}

0 comments on commit 5cd54dd

Please sign in to comment.