First, I'm using R 3.6.0 and Rstudio 1.2 with Windows 10.
I am using flextable and Officer to create a Word document. Into this table I insert some images. To do this I am using flextable. When I use this code with a R script and officer that work. But, When I use this code in Rmarkdown for generate a Word document, that doesn't work. The code Under Rmardown:
library(flextable)
library(officer)
img.file <- file.path( R.home("doc"), "html", "logo.jpg" )
myft <- flextable( head(iris))
myft <- compose( myft, i = 1:3, j = 1,
value = as_paragraph(
as_image(src = img.file, width = .20, height = .15),
" blah blah ",
as_chunk(Sepal.Length, props = fp_text(color = "red"))
),
part = "body")
myft
I have a message that tell me: "Sorry, we can't open the document because we have discovered a problem with its content.
I think there is a problem with the image in flextable. When I remove these image, that work.