1

I'm trying to change some specific words formatting to bold but can't find the the way to do it.

For example:

I would like to change the word "text" to bold in this code:

doc <- read_docx() %>%
   body_add_par("This is a sample text", style = "centered")

How could I do it?

1 Answers1

1

You can use body_add_fpar to achieve that. From the documentation:

bold_face <- shortcuts$fp_bold(font.size = 30)
bold_redface <- update(bold_face, color = "red")
fpar_ <- fpar(ftext("Hello ", prop = bold_face),
              ftext("World", prop = bold_redface ),
              ftext(", how are you?", prop = bold_face ) )
doc <- read_docx() %>% body_add_fpar(fpar_)
Sven
  • 1,203
  • 1
  • 5
  • 14