View source: R/convertxlsform.R
| convertxlsform | R Documentation |
Reads an XLSForm (as used by Open Data Kit and KoboToolbox) and writes a
formatted paper version for interviewing and review. The default output is
a Word document next to the input file. A PDF is made by converting the
Word document with LibreOffice (or Microsoft Word through the doconv
package); see docx_to_pdf() and has_libreoffice().
convertxlsform(xlsform, output = NULL, format = NULL, lang = NULL, ...)
xlsform |
Path to an XLSForm ( |
output |
Output file or folder, see Details. |
format |
|
lang |
Language to use: a code ( |
... |
Further options, all named. Defaults are in brackets.
|
The path or paths of the files written, as a character vector, invisibly.
output = NULL: same folder and base name as xlsform, with the new
extension.
output is an existing folder: <base name>.<ext> inside it.
output is a file path: used as given. Its extension (.docx or
.pdf) sets format when format is NULL, and must agree with
format otherwise.
Two formats (format = c("docx", "pdf")) write two files with the same
base name. With a file path in output, its extension is replaced.
An existing file is never replaced unless overwrite = TRUE.
xlsform_outline() to inspect a form before converting it,
docx_to_pdf(), and cli() for the terminal.
path <- system.file("extdata", "minimal", "minimal.xlsx",
package = "convertxlsform")
out <- file.path(tempdir(), "minimal.docx")
convertxlsform(path, output = out, verbose = FALSE, overwrite = TRUE)
# A multilingual form: another language, flat question numbers, US letter
path_ml <- system.file("extdata", "multilang", "multilang.xlsx",
package = "convertxlsform")
convertxlsform(path_ml, output = tempdir(), lang = "bn",
nested_serial_numbers = FALSE, page_size = "letter",
verbose = FALSE, overwrite = TRUE)
# PDF needs LibreOffice
if (interactive() && has_libreoffice()) {
convertxlsform(path, output = tempdir(), format = "pdf",
verbose = FALSE, overwrite = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.