I'm trying to highlight a set of words, for example word1
and word2
from an imported word document using the officer package in R. I am now stuck after setting the text properties for the word. How do I get officer to highlight the words in the colors?
I've read the data file using read_docx(filename)
.
I've also set the text properties using fp_text()
and ftext()
.
my_doc <- read_docx(file.path(filepath,myfile))
color1 <- fp_text(color = "blue", font.size = 10, bold = FALSE,
italic = FALSE, underlined = FALSE, font.family = "Arial",
vertical.align = "baseline", shading.color = "transparent")
ftext("word1", color1)
color2 <- fp_text(color = "red", font.size = 10, bold = FALSE,
italic = FALSE, underlined = FALSE, font.family = "Arial",
vertical.align = "baseline", shading.color = "transparent")
ftext("word2", color1)