Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

style

Set flextable style


Description

Modify flextable text, paragraphs and cells formatting properties. It allows to specify a set of formatting properties for a selection instead of using multiple functions (.i.e bold, italic, bg) that should all be applied to the same selection of rows and columns.

Usage

style(
  x,
  i = NULL,
  j = NULL,
  pr_t = NULL,
  pr_p = NULL,
  pr_c = NULL,
  part = "body"
)

Arguments

x

a flextable object

i

rows selection

j

columns selection

pr_t

object(s) of class fp_text

pr_p

object(s) of class fp_par

pr_c

object(s) of class fp_cell

part

partname of the table (one of 'all', 'body', 'header' or 'footer')

Illustrations

Examples

library(officer)
def_cell <- fp_cell(border = fp_border(color="wheat"))

def_par <- fp_par(text.align = "center")

ft <- flextable(head(mtcars))

ft <- style( ft, pr_c = def_cell, pr_p = def_par, part = "all")
ft <- style(ft, ~ drat > 3.5, ~ vs + am + gear + carb,
  pr_t = fp_text(color="red", italic = TRUE) )

ft

flextable

Functions for Tabular Reporting

v0.6.10
GPL-3
Authors
David Gohel [aut, cre], Clementine Jager [ctb], Quentin Fazilleau [ctb], Maxim Nazarov [ctb] (rmarkdown for docx output), Titouan Robert [ctb], Michael Barrowman [ctb] (inline footnotes), Atsushi Yasumoto [ctb] (support for bookdown cross reference), Paul Julian [ctb] (support for gam objects)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.