I have populated a dataframe by getting data from SQL, I am using Officer Package to sent it to PPT.
It works well when only text or numbers in the columns of a dataframe but when a image is in by the side of text it not getting the image.
You won't get any image display as output format is PowerPoint. This is not a choice nor a
unimplemented feature. This is because PowerPoint is not able to embed images in a table cell.
That’s a PowerPoint limitation.
I wrote a full example for the sake of reproducibility
# you need the latest version of flextable that should be on cran soon
# remotes::install_github("davidgohel/flextable")
library(flextable)
library(officer)
library(magrittr)
table2 <- flextable( head(iris, n = 10 )) %>%
compose( j = 1,
value = as_paragraph(
minibar(value = Sepal.Length, max = max(Sepal.Length))
), part = "body") %>% autofit()
read_pptx() %>%
add_slide(layout = "Title and Content", master = "Office Theme") %>%
ph_with_flextable_at(value = table2, left = 1, top = 2) %>%
print(target = "Error.pptx")