File: style.Rd

package info (click to toggle)
r-cran-flextable 0.8.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,264 kB
  • sloc: sh: 15; makefile: 2
file content (58 lines) | stat: -rw-r--r-- 1,295 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/styles.R
\name{style}
\alias{style}
\title{Set flextable style}
\usage{
style(
  x,
  i = NULL,
  j = NULL,
  pr_t = NULL,
  pr_p = NULL,
  pr_c = NULL,
  part = "body"
)
}
\arguments{
\item{x}{a flextable object}

\item{i}{rows selection}

\item{j}{columns selection}

\item{pr_t}{object(s) of class \code{fp_text}}

\item{pr_p}{object(s) of class \code{fp_par}}

\item{pr_c}{object(s) of class \code{fp_cell}}

\item{part}{partname of the table (one of 'all', 'body', 'header' or 'footer')}
}
\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 \code{bold}, \code{italic}, \code{bg}) that
should all be applied to the same selection of rows and columns.
}
\section{Illustrations}{


\if{html}{\figure{fig_style_1.png}{options: width="500"}}
}

\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
}