docx files rendered with Quarto fail to open if table cells include images, for example using the as_image or colformat_image functions. For example, if we include the example provided by ?as_image in a Quarto document, the result is broken. A minimal file is:
---
format: docx
---
```{r}
library(flextable)
img.file <- file.path(
R.home("doc"),
"html", "logo.jpg"
)
if (require("magick")) {
myft <- flextable(head(iris))
myft <- compose(
myft,
i = 1:3, j = 1,
value = as_paragraph(
as_image(src = img.file),
" ",
as_chunk(
Sepal.Length,
props = fp_text_default(color = "red")
)
),
part = "body"
)
ft <- autofit(myft)
ft
}
```
The typical error I get when opening the generated file is:
