Skip to contents

Deprecated in 0.8.x (warns once a session, still works); removed in 0.9.0. Give assemble_rtf() the table of contents itself (toc = the table from assemble_folder()).

Usage

assemble_toc(files = NULL, spec = NULL, ...)

Arguments

files

Vector of .rtf paths.

spec

Optional assembly spec (from assemble_spec()); when supplied, files is ignored and the spec is converted directly.

...

Passed to assemble_spec() when building from files.

Value

A list suitable for assemble_rtf(toc = ).

Details

Convenience wrapper that reads the files (via assemble_spec()) and returns the toc = list of toc_heading() / toc_entry() objects ready for assemble_rtf(). Pass a ready-made spec to convert that instead.

Examples

# two TFL files in a folder, as a study's output
dir <- file.path(tempdir(), "tfl")
dir.create(dir, showWarnings = FALSE)
for (t in c("14.1.1", "14.2.1")) {
  doc <- rtf_document() |>
    rtf_tables(data.frame(Parameter = "Age", Value = "75.1")) |>
    rtf_titles(list(c(paste("Table", t), "Safety Population")))
  generate_rtfreport(doc, file.path(dir, paste0("t", gsub(".", "_", t,
    fixed = TRUE), ".rtf")), overwrite = TRUE)
}
# instead: the table of contents as the `toc`
assemble_rtf(toc = assemble_folder(dir), output_file = tempfile(fileext = ".rtf"))