Learn R Programming

flextable (version 0.10.0)

indentation: Set paragraph indents

Description

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()).

Usage

indentation(
  x,
  i = NULL,
  j = NULL,
  first_line = NULL,
  hanging = NULL,
  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>.

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_line and hanging are provided, hanging wins.

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(), tab_settings(), valign()

Examples

Run this code
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

Run the code above in your browser using DataLab