Skip to contents

The function is concatenating text and images within paragraphs of a flextable object, this function is to be used with functions such as compose(), add_header_lines(), add_footer_lines().

This allows the concatenation of formatted pieces of text (chunks) that represent the content of a paragraph.

The cells of a flextable contain each a single paragraph. This paragraph is made of chunks that can be text, images or plots, equations and links.

Usage

as_paragraph(..., list_values = NULL)

Arguments

...

chunk elements that are defining paragraph. If a character is used, it is transformed to a chunk object with function as_chunk().

list_values

a list of chunk elements that are defining paragraph. If specified argument ... is unused.

See also

as_chunk(), minibar(), as_image(), hyperlink_text()

Other functions for mixed content paragraphs: append_chunks(), compose(), prepend_chunks()

Examples

library(flextable)
ft <- flextable(airquality[sample.int(150, size = 10), ])
ft <- compose(ft,
  j = "Wind",
  value = as_paragraph(
    as_chunk(Wind, props = fp_text_default(color = "orange")),
    " ",
    minibar(value = Wind, max = max(airquality$Wind), barcol = "orange", bg = "black", height = .15)
  ),
  part = "body"
)
ft <- autofit(ft)
ft

Ozone

Solar.R

Wind

Temp

Month

Day

39

83

6.9

81

8

1

64

11.5

79

8

15

259

10.9

93

6

11

66

4.6

87

8

6

150

6.3

77

6

21

59

1.7

76

6

22

266

14.9

58

5

26

35

7.4

85

8

5

168

238

3.4

81

8

25

44

236

14.9

81

9

11