'Is it possible to underline a dynamic bit of text for a word document output?

I am able to underline text thanks to the following code

```
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(officedown)
library(officer)
ft <- fp_text(underlined = TRUE)
```

`r ftext("header", ft)`

which outputs "header" underlined as expected.

However in the below example i plan to make the month and year dynamic to try and underline the text "date - February 2022"

```
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
month <- "February"
year <- "2022"
library(officedown)
library(officer)
ft <- fp_text(underlined = TRUE)
header_text <- cat("date - ",month,year,"")
```

`r ftext(header_text , ft)`
`r ftext(print(header_text) , ft)`
`r ftext(cat("date - ",month,year,""), ft)`

but these three return nothing.

Any Help is appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source