convertxlsform 0.4.0
New features
- Built-in printed phrases (“Ask if”, “Choose one answer”, “Page 1 of 3” and the rest) for Spanish (
es), Portuguese (pt), Arabic (ar), Bengali (bn) and Swahili (sw), in addition to English and French. The new tables were machine-drafted and are waiting for review by native speakers;stringsstill overrides any phrase. Forms whose language headers give only a native name, such aslabel::Español,label::Português,label::العربيةorlabel::বাংলা, now get the matching code. - “Go to” instructions. A single-choice question whose answer hides later questions now shows, next to that choice, the question to go to next, for example “No → Go to Q5”, or “Go to end”. The instruction is worked out from the
relevantexpressions of the questions that follow; it is left out when the result depends on other answers or would leave a repeat group.include_skips = FALSE(or--no-skips) turns it off. - Roster tables for repeat groups. A repeat of simple questions (text, numbers, single and multiple choice, dates, times, barcodes, ranges) is drawn as a table with one row per member and one column per question, with the code lists and skip logic below it. A fixed
repeat_countsets the number of rows, otherwiseroster_rows(default 5).repeat_layout = "auto"(the default) uses a roster for repeats of up to 6 such questions,"roster"allows up to 10, and"copies"keeps the earlier layout. - Grids for
table-listandlist-nolabel. A group with thetable-listappearance whose questions share a choice list, and alabelquestion followed bylist-nolabelquestions, are drawn as one grid with a row per question and a column per choice. Thelabelquestion gives the column headings and takes no number. - Bilingual documents.
lang2(--lang2) prints a second language on a new line under each label, hint, constraint message and choice of the first. - Right-to-left layout. Forms in Arabic or Hebrew are laid out right to left: paragraphs, tables and the page.
rtl = TRUEorFALSE(--rtl,--ltr) overrides the detection. - The
entitiessheet of ODK entity forms is read. The entity lists are named in the front matter, and withshow_variable_names = TRUEa question’ssave_toproperty is shown next to its name. - More XLSForm types and spellings:
background-geopoint(hidden),osm(captured on the device), and the pyxform aliasesselect all that apply,select_all_that_apply,select1,int,string,gps,locationandphoto. - More XLSForm functions are written in plain language in skip logic, constraints and choice filters:
string-length(),regex(),selected-at(),jr:choice-name(),count(),position(..),indexed-repeat(),if(),coalesce(),int(),round(),number(),date()anddecimal-date-time(). An age check such asint((today() - ${dob}) div 365.25) >= 18reads “years since Q3 (dob) >= 18”.once(),uuid()andpulldata()are shown as “a calculated value”. The wording is in the string tables, so it can be translated or overridden withstrings(#20). - XML choice files are read for
select_one_from_fileandselect_multiple_from_file, as CSV files already were (#21). - Language names are recognized in many more headers without a code, in English or in their own script, for example
label::Spanish,label::Españolorlabel::বাংলা, so the built-in strings of that language are used.lang = "Arabic"also finds a column headedlabel::ar(#18). - New terminal options:
--lang2,--no-skips,--rtl,--ltr,--font-cs,--repeat-layoutand--roster-rows.
Bug fixes
- PDF output no longer shows blank text for Bengali, Ethiopic and other complex scripts when LibreOffice does not find the font on its own (the known issue of 0.3.0). The files of the complex-script font are copied into the temporary LibreOffice profile used for the conversion, and a warning names the font when it is not installed.
docx_to_pdf()gains afontsargument, and the optionconvertxlsform.fonts, to give LibreOffice more font files or folders. - The complex-script font is now the first installed font from a list for each script (for Bengali: Noto Sans Bengali, Noto Serif Bengali, Kohinoor Bangla, Bangla Sangam MN, Nirmala UI, Vrinda, and others), instead of always the Noto font.
- The last paragraph of a question no longer keeps with the next question. The template styles keep paragraphs together, and officer did not write the paragraph-level override, so long runs of questions were glued together and page breaks fell in odd places.
Performance
- Rendering is several times faster and now grows linearly with the size of the form. Answer boxes and choice lists are written as Word XML directly instead of through flextable, and the document body is written in one pass. In a test form of 300 questions, writing the Word document took about 6 seconds instead of about 2 minutes.
Other changes
- The DESCRIPTION Title and Description put single quotes only around software names (‘Microsoft Word’, ‘LibreOffice’, ‘Open Data Kit’, ‘KoboToolbox’), as CRAN asked.
- New vignette, “Changing the look with a template”, on making a custom Word template: the styles convertxlsform uses, how to edit them in Word, LibreOffice or R, and which options override the template (#25).
- The README has a CRAN status badge and gives
install.packages("convertxlsform")as the main way to install. -
systemfontsis a new import (it was already installed with flextable). officer 0.6.10 or later is required.
convertxlsform 0.3.0
CRAN release: 2026-10-21
A complete rewrite. The package writes Word and PDF paper versions of an XLSForm through a new API, a terminal interface and one document model that both outputs share.
New features
-
convertxlsform()writes a Word document (.docx) by default.format = "pdf"orformat = c("docx", "pdf")also writes a PDF. The output location, format and overwrite rules follow from the arguments, and the function returns the paths invisibly. - PDF output converts the Word document with LibreOffice. Microsoft Word is used through the
doconvpackage when LibreOffice is not found.docx_to_pdf()andhas_libreoffice()are exported. -
cli()runs a conversion from a terminal, for exampleRscript -e 'convertxlsform::cli()' form.xlsx --format pdf. Scripts can usequit(status = convertxlsform::cli())to get the exit status. -
xlsform_outline()returns the numbered form as a data frame, for checking a form before conversion. -
xlsform_languages()lists the languages in a form and marks the default. - Language columns are read from
label::English (en),label::enandlabel::English. Thelangargument accepts a code, a name or the full suffix. A blank translated cell falls back to the plain column, then to the default language. Headers with a common language name only, such aslabel::French, also match their ISO 639-1 code (lang = "fr"). - Skip logic, constraints and choice filters are written in plain language. Expressions that cannot be read are shown as written.
- Connective phrases such as “Ask if” come from built-in English and French tables. The
stringsoption replaces any of them for another language. - Paper layouts for each question type: single and multiple choice, rank, long lists as code boxes, write-in boxes, numeric, date and time formats, geographic and media questions, and acknowledgments.
- Groups and repeat groups, with nested numbering (
nested_serial_numbers) and blank copies of repeats (repeat_copies). - Question images are scaled to at most 2 inches tall, and choice images to at most 0.6 inches. A missing media or choice file triggers one combined warning, and a missing image prints a placeholder.
- Complex-script fonts are chosen from the text for Bengali, Arabic, Devanagari and Ethiopic. The
font_family_csoption overrides the choice. - Page size, orientation, margins (up to 2 inches), fonts, a reference
template,title, and switches for hints, constraints, relevants, choice codes, variable names and hidden rows. - Bundled examples:
inst/extdata/multilang(multilingual, with an external choice list and images) andinst/extdata/all_types(every question type and feature the package renders).
Changes from 0.2.1
- Arguments are renamed:
xlsform_pathis nowxlsform,output_docxis nowoutput,selected_languageis nowlang, andnumber_questionsis nownested_serial_numbers. The 0.2.1 names are not accepted. - HTML tags in labels are stripped. Emphasis in Markdown is rendered.
- Imports are reduced to
cli,flextable,magrittr,officer,readxl,rlangandzip, plus base packages (stats,tools,utils).optparseis no longer used, and the command line is parsed bycli().
convertxlsform 0.2.1 (2025-07-XX)
- Title field capitalization corrected in DESCRIPTION.
- Added runnable examples in documentation.
- Version bump for CRAN resubmission.
convertxlsform 0.2.0 (2025-07-19)
First public release.
Highlights
-
Full XLSForm support
- Reads
survey,choices, andsettingssheets; errors if any are missing or malformed. - Preserves HTML/Markdown in
label,hint, andconstraint_messageviacommonmarktoofficer::body_add_html.
- Reads
-
Rich Word output
- Document title (from
form_title) in 16 pt bold Arial, centered. - “Mandatory questions are marked with an asterisk (*) symbol.” note under the header.
- Optional language line.
- All body text in 11 pt Arial, left-aligned.
- Document title (from
-
Question formatting
- Required questions flagged with
*. - Optional nested numbering (
number_questions = TRUE) for top‑level, groups, and repeats. - Notes printed as
Note: …(no numbering). - Hints and images (capped at 2″ height) embedded inline.
- Constraint messages in parentheses; relevant clauses appended.
- Required questions flagged with
-
Answer layouts
-
select_one / rank: larger hollow‐circle bullets (
\u25EF). -
select_multiple: larger hollow‐square bullets (
\u2B1B). -
select_one_from_file: prints attachment notice.
-
range: generates choices from
start,end,step. -
Text / numeric / date / time: bordered text boxes spanning full page width (6.5″), with 2–4 empty lines.
- Media / file / note types: appropriate prompts or skips.
-
select_one / rank: larger hollow‐circle bullets (
-
Choice images
- If
choices$imageis provided and file exists, embeds under each bullet (max 1″ height). - Missing files trigger a warning and are noted next to the label.
- If
Packaging & internals
-
Dependencies:
readxl,officer,commonmark,flextable,magickdeclared in Imports. -
ASCII compliance: all Unicode in code replaced with
\uXXXXescapes. -
Roxygen imports: explicit
@importFromfor all used functions. -
Tests: initial
testthatscaffold with basic validation tests.
Thank you for using convertxlsform: feedback and issues are welcome on GitHub (https://github.com/masud90/convertxlsform)!
