tab_settings: Set tabulation marks configuration

View source: R/styles.R

tab_settingsR Documentation

Set tabulation marks configuration

Description

Define tabulation marks configuration. Specifying the positions and types of tabulation marks in table paragraphs helps organize content, especially in clinical tables, by aligning numbers properly.

Usage

tab_settings(x, i = NULL, j = NULL, value = TRUE, part = "body")

Arguments

x

a 'flextable' object, see flextable-package to learn how to create 'flextable' object.

i

row selector, see section Row selection with the i parameter in <Selectors in flextable>.

j

column selector, see section Column selection with the j parameter in <Selectors in flextable>.

value

an object generated by officer::fp_tabs().

part

part selector, see section Part selection with the part parameter in <Selectors in flextable>. Value 'all' can be used.

See Also

Other formatting shortcuts: align(), bg(), bold(), color(), empty_blanks(), font(), fontsize(), highlight(), italic(), keep_with_next(), line_spacing(), padding(), rotate(), style(), valign()

Examples

library(officer)
library(flextable)

z <- data.frame(
  Statistic = c("Median (Q1 ; Q3)", "Min ; Max"),
  Value = c(
    "\t999.99\t(99.9 ; 99.9)",
    "\t9.99\t(9999.9 ; 99.9)"
  )
)

ts <- fp_tabs(
  fp_tab(pos = 0.4, style = "decimal"),
  fp_tab(pos = 1.4, style = "decimal")
)

zz <- flextable(z)
zz <- tab_settings(zz, j = 2, value = ts)
zz <- width(zz, width = c(1.5, 2))


save_as_docx(zz, path = tempfile(fileext = ".docx"))

flextable documentation built on June 2, 2026, 9:08 a.m.