officer (version 0.3.14)

ftext: formatted chunk of text

Description

Format a chunk of text with text formatting properties (bold, color, ...).

The function allows you to create pieces of text formatted in a certain way. You should use this function in conjunction with fpar to create paragraphs consisting of differently formatted text parts.

Usage

ftext(text, prop)

Arguments

text

text value, a string.

prop

formatting text properties returned by fp_text.

See Also

fp_text

Other run functions for reporting: external_img(), run_autonum(), run_columnbreak(), run_linebreak(), run_pagebreak(), run_reference(), run_seqfield()

Examples

Run this code
# NOT RUN {
ftext("hello", fp_text())

properties1 <- fp_text(color = "red")
properties2 <- fp_text(bold = TRUE, shading.color = "yellow")
ftext1 <- ftext("hello", properties1)
ftext2 <- ftext("World", properties2)
paragraph <- fpar(ftext1, " ", ftext2)

x <- read_docx()
x <- body_add(x, paragraph)
print(x, target = tempfile(fileext = ".docx"))
# }

Run the code above in your browser using DataCamp Workspace