File: set_flextable_defaults.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 (183 lines) | stat: -rw-r--r-- 6,548 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/defaults.R
\name{set_flextable_defaults}
\alias{set_flextable_defaults}
\alias{init_flextable_defaults}
\title{Modify flextable defaults formatting properties}
\usage{
set_flextable_defaults(
  font.family = NULL,
  font.size = NULL,
  font.color = NULL,
  text.align = NULL,
  padding = NULL,
  padding.bottom = NULL,
  padding.top = NULL,
  padding.left = NULL,
  padding.right = NULL,
  border.color = NULL,
  background.color = NULL,
  line_spacing = NULL,
  table.layout = NULL,
  cs.family = NULL,
  eastasia.family = NULL,
  hansi.family = NULL,
  decimal.mark = NULL,
  big.mark = NULL,
  digits = NULL,
  na_str = NULL,
  nan_str = NULL,
  fmt_date = NULL,
  fmt_datetime = NULL,
  extra_css = NULL,
  shadow = NULL,
  scroll = NULL,
  split = NULL,
  keep_with_next = NULL,
  tabcolsep = NULL,
  arraystretch = NULL,
  float = NULL,
  fonts_ignore = NULL,
  theme_fun = NULL,
  post_process_pdf = NULL,
  post_process_docx = NULL,
  post_process_html = NULL,
  post_process_pptx = NULL
)

init_flextable_defaults()
}
\arguments{
\item{font.family}{single character value. When format is Word, it specifies the font to
be used to format characters in the Unicode range (U+0000-U+007F).}

\item{font.size}{font size (in point) - 0 or positive integer value.}

\item{font.color}{font color - a single character value specifying
a valid color (e.g. "#000000" or "black").}

\item{text.align}{text alignment - a single character value, expected value
is one of 'left', 'right', 'center', 'justify'.}

\item{padding}{padding (shortcut for top, bottom, left and right padding)}

\item{padding.bottom, padding.top, padding.left, padding.right}{paragraph paddings - 0 or
positive integer value.}

\item{border.color}{border color - single character value
(e.g. "#000000" or "black").}

\item{background.color}{cell background color - a single character value specifying a
valid color (e.g. "#000000" or "black").}

\item{line_spacing}{space between lines of text, 1 is single line spacing, 2 is double line spacing.}

\item{table.layout}{'autofit' or 'fixed' algorithm. Default to 'autofit'.}

\item{cs.family}{optional and only for Word. Font to be used to format
characters in a complex script Unicode range. For example, Arabic
text might be displayed using the "Arial Unicode MS" font.}

\item{eastasia.family}{optional and only for Word. Font to be used to
format characters in an East Asian Unicode range. For example,
Japanese text might be displayed using the "MS Mincho" font.}

\item{hansi.family}{optional and only for Word. Font to be used to format
characters in a Unicode range which does not fall into one of the
other categories.}

\item{decimal.mark, big.mark, na_str, nan_str}{\link{formatC} arguments used by \code{\link[=colformat_num]{colformat_num()}},
\code{\link[=colformat_double]{colformat_double()}}, and \code{\link[=colformat_int]{colformat_int()}}.}

\item{digits}{\link{formatC} argument used by \code{\link[=colformat_double]{colformat_double()}}.}

\item{fmt_date, fmt_datetime}{formats for date and datetime columns as
documented in \code{\link[=strptime]{strptime()}}. Default to '\%Y-\%m-\%d' and '\%Y-\%m-\%d \%H:\%M:\%S'.}

\item{extra_css}{css instructions to be integrated with the table.}

\item{shadow}{\code{TRUE} or \code{FALSE}, use shadow dom (for HTML only), this option is existing
to disable shadow dom (set to \code{FALSE}) for pagedown and Quarto that can
not support it for now.}

\item{scroll}{NULL or a list if you want to add a scroll-box.
See \strong{scroll} element of argument \code{opts_html} in function \code{\link[=set_table_properties]{set_table_properties()}}.}

\item{split}{Word option 'Allow row to break across pages' can be
activated when TRUE.}

\item{keep_with_next}{Word option 'keep rows together' is
activated when TRUE. It avoids page break within tables. This
is handy for small tables, i.e. less than a page height.}

\item{tabcolsep}{space between the text and the left/right border of its containing
cell.}

\item{arraystretch}{height of each row relative to its default
height, the default value is 1.5.}

\item{float}{type of floating placement in the PDF document, one of:
\itemize{
\item 'none' (the default value), table is placed after the preceding
paragraph.
\item 'float', table can float to a place in the text where it fits best
\item 'wrap-r', wrap text around the table positioned to the right side of the text
\item 'wrap-l', wrap text around the table positioned to the left side of the text
\item 'wrap-i', wrap text around the table positioned inside edge-near the binding
\item 'wrap-o', wrap text around the table positioned outside edge-far from the binding
}}

\item{fonts_ignore}{if TRUE, pdf-engine pdflatex can be used instead of
xelatex or lualatex. If pdflatex is used, fonts will be ignored because they are
not supported by pdflatex, whereas with the xelatex and lualatex engines they are.}

\item{theme_fun}{a single character value (the name of the theme function
to be applied) or a theme function (input is a flextable, output is a flextable).}

\item{post_process_pdf, post_process_docx, post_process_html, post_process_pptx}{Post-processing functions
that will allow you to customize the display by output type (pdf, html, docx, pptx).
They are executed just before printing the table.}
}
\value{
a list containing previous default values.
}
\description{
The current formatting properties (see \code{\link[=get_flextable_defaults]{get_flextable_defaults()}})
are automatically applied to every flextable you produce.
Use \code{set_flextable_defaults()} to override them. Use \code{init_flextable_defaults()}
to re-init all values with the package defaults.
}
\section{Illustrations}{


\if{html}{\figure{fig_set_flextable_defaults_1.png}{options: width="400"}}

\if{html}{\figure{fig_set_flextable_defaults_2.png}{options: width="400"}}
}

\examples{
ft_1 <- qflextable(head(airquality))
ft_1

old <- set_flextable_defaults(
  font.color = "#AA8855",
  border.color = "#8855AA")
ft_2 <- qflextable(head(airquality))
ft_2

do.call(set_flextable_defaults, old)
}
\seealso{
Other functions related to themes: 
\code{\link{get_flextable_defaults}()},
\code{\link{theme_alafoli}()},
\code{\link{theme_apa}()},
\code{\link{theme_booktabs}()},
\code{\link{theme_box}()},
\code{\link{theme_tron_legacy}()},
\code{\link{theme_tron}()},
\code{\link{theme_vader}()},
\code{\link{theme_vanilla}()},
\code{\link{theme_zebra}()}
}
\concept{functions related to themes}