Skip to contents

hrule() controls whether row heights are automatic, minimum or fixed. This only affects Word and PowerPoint outputs; it has no effect on HTML or PDF.

  • "auto" (default): the row height adjusts to fit the content; any value set by height() is ignored.

  • "atleast": the row is at least as tall as the value set by height(), but can grow if the content is taller.

  • "exact": the row is exactly the height set by height(); content that overflows is clipped.

For PDF see the ft.arraystretch chunk option.

Usage

hrule(x, i = NULL, rule = "auto", 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>.

rule

specify the meaning of the height. Possible values are "atleast" (height should be at least the value specified), "exact" (height should be exactly the value specified), or the default value "auto" (height is determined based on the height of the contents, so the value is ignored).

part

part selector, see section Part selection with the part parameter in <Selectors in flextable>. Value 'all' can be used.

See also

Examples


ft_1 <- flextable(head(iris))
ft_1 <- width(ft_1, width = 1.5)
ft_1 <- height(ft_1, height = 0.75, part = "header")
ft_1 <- hrule(ft_1, rule = "exact", part = "header")
ft_1

Sepal.Length

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

ft_2 <- hrule(ft_1, rule = "auto", part = "header") ft_2

Sepal.Length

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