← Back to all sparks
R

r2rtf

ANALYTICS
Velocity0.0

Easily Create Production-Ready Rich Text Format (RTF) Table and Figure

The clinical-report table engine learned Chinese, then learned to leave RTF entirely

clinical-reportingrtfinternationalizationdocument-conversionpharmaverse
Current state
r2rtf builds the RTF tables, listings and figures that go into clinical study reports, and its recent releases have been about widening who and what it can serve rather than changing how tables are composed. The 1.2.0 release added internationalization — a SimSun font path for Chinese characters plus hyphenation control — and 1.3.0 followed with write_docx() and write_html(), turning the LibreOffice conversion the package had documented into exported functions.
Where it's heading
Two threads run through the window. One is output reach: RTF remains the composition target, but the artifacts that come out of it now include DOCX and HTML, and page numbering can be made table-relative across multi-page tables. The other is durability under a moving R and font stack — the ANSI/Unicode converter was rebuilt, the LaTeX mapping table generated from code rather than shipped as sysdata, unlist() usage fixed for R 4.5, and graphics-device leaks that produced stray Rplots.pdf closed off.
Prediction
Having exported DOCX and HTML conversion, the likely next step is filling in what those formats lose relative to RTF — pagination and footnote fidelity are the obvious gaps. The i18n path currently covers Chinese only, so additional font families are the other plausible direction.

Recent moves

  1. 7mo ago

    DOCX and HTML output become exported functions

    Exports write_docx() and write_html(), which run encoded RTF through LibreOffice — the same conversion the package has supported since 1.1.1 and shipped as vignette artifacts, now available as functions. Also adds a \pagenumber_hardcoding control word for table-relative page numbering in multi-page tables, and stops strwidth()/par() leaking a graphics device and emitting a stray Rplots.pdf.

    View source ↗
  2. 11mo ago

    Chinese character support arrives via an i18n font path

    ⚡ SPARK

    Adds internationalization through a use_i18n parameter on rtf_page() that enables SimSun for Chinese characters, plus text_hyphenation control on titles, column headers and sublines. Until this release the package could compose a table for a submission only if the text was Latin-script, which bounded it to one set of regulators.

    View source ↗
  3. 1y ago

    Text colour fixed for figures encoded into RTF

    Fixes text colour when figures are encoded into RTF, and guards examples and tests against officer losing its systemfonts dependency. Small, but colour in embedded figures is visible in the delivered artifact.

    View source ↗
  4. 1y ago

    Footnote handling fixed for R 4.5.0

    Corrects unlist() usage in as_rtf_footnote() that would have errored for downstream code under R 4.5.0. Forward-compatibility maintenance ahead of the R release.

    View source ↗
  5. 1y ago

    Unicode converter rebuilt and mapping table made inspectable

    Rebuilds the symbol-to-ANSI/Unicode converter for speed and robustness, and generates the Unicode/LaTeX mapping table from code instead of shipping it as an opaque sysdata.rda — the table is now inspectable at r2rtf:::unicode_latex. Groundwork that the i18n work in 1.2.0 sits on top of.

    View source ↗
  6. 2y ago

    UTF-8 conversion fix and LibreOffice 7.6 support

    Fixes conversion of UTF-8 code points at or above 128 and adds LibreOffice 7.6 support with clearer error messages. Both are early moves in the two threads that later define this window — character handling and the conversion path out of RTF.

    View source ↗