Skip to contents

Renders a one-page clinical report to an editable Word document using officer (with flextable when available) — no LaTeX toolchain required. Called by renderClinicalReport for format = "docx"; usable directly.

Usage

buildDocxReport(
  data,
  template = c("gait", "hrv", "emg"),
  lang = c("en", "ja"),
  out
)

Arguments

data

A report payload list (see renderClinicalReport): subject, figures (a named list of ggplots), change (an optional change_annotation) and provenance (an optional named list).

template

One of "gait", "hrv", "emg" (drives the localized title).

lang

"en" or "ja".

out

Output .docx path.

Value

out, invisibly.

Examples

# Writes an editable .docx via officer (a Suggests dependency) into tempdir().
if (requireNamespace("officer", quietly = TRUE)) {
  fig <- plotNormativeBand(NULL, NormativeModel(
    mean = sin(seq(0, pi, length.out = 101)), sd = rep(0.1, 101), time = 0:100))
  out <- tempfile(fileext = ".docx")
  buildDocxReport(list(subject = "P01", figures = list(gait_cycle = fig)),
                  template = "gait", out = out)
}