I'm creating a couple of tables for a Word document using the flextable package, which I'm loving. However, I'm having a little trouble bolding part of the text in my table title. For example, I want the title to read, "Table 1. The rest of my table title." instead of "Table 1. The rest of my table title."
I found this documentation, and after some trial and error I finally got the result I wanted. But it feels like there may be a more straightforward way to get it. Here is my current solution:
library(dplyr)
library(flextable)
mtcars_ft <- flextable(head(mtcars)) %>%
# Add a blank title line to top of table
add_header_lines("") %>%
# Use compose to bold "Table #."
compose(
i = 1, part = "header",
value = as_paragraph(
as_chunk("Table 1. ", props = fp_text(bold = TRUE)),
"Here is my example mtcars ft."
),
)
Here is a screenshot of my result:

