Build a TOC definition from a set of RTF files (deprecated)
Source:R/assemble_spec.R
assemble_toc.RdDeprecated 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()).
Arguments
- files
Vector of
.rtfpaths.- spec
Optional assembly spec (from
assemble_spec()); when supplied,filesis ignored and the spec is converted directly.- ...
Passed to
assemble_spec()when building fromfiles.
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"))