Change the first-line or hanging indent of paragraphs in selected rows and columns of a flextable.
A first-line indent moves only the first line of the paragraph to the
right. A hanging indent moves all lines but the first one to the
right; the indented lines start at the paragraph left padding plus the
hanging value, so hanging should not exceed the left padding
(see padding()).
Arguments
- x
a 'flextable' object, see flextable-package to learn how to create 'flextable' object.
- i
row selector, see section Row selection with the
iparameter in <Selectors in flextable>.- j
column selector, see section Column selection with the
jparameter in <Selectors in flextable>.- first_line
first-line indent in pts (points). Use NA to unset.
- hanging
hanging indent in pts (points). Use NA to unset. If both
first_lineandhangingare provided,hangingwins.- part
part selector, see section Part selection with the
partparameter 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(),
tab_settings(),
valign()
Examples
ft_1 <- flextable(head(iris))
ft_1 <- mk_par(
x = ft_1, i = 1, j = 1, part = "header",
value = as_paragraph("A rather long header that will wrap on two lines")
)
ft_1 <- padding(ft_1, i = 1, j = 1, padding.left = 30, part = "header")
ft_1 <- indentation(ft_1, i = 1, j = 1, hanging = 20, part = "header")
ft_1 <- width(ft_1, j = 1, width = 1.2)
ft_1
A rather long header that will wrap on two lines
Sepal.Width
Petal.Length
Petal.Width
Species
5.1
3.5
1.4
0.2
setosa
4.9
3.0
1.4
0.2
setosa
4.7
3.2
1.3
0.2
setosa
4.6
3.1
1.5
0.2
setosa
5.0
3.6
1.4
0.2
setosa
5.4
3.9
1.7
0.4
setosa
