Hi,
I've figured out a workaround for exporting "Plotly" graphs to PowerPoint.
I'm listing the code below for anyone's reference:
library(officer)
library(magrittr)
library(plotly)
library(htmlwidgets)
library(webshot)
temp_file_proc <- tempfile(pattern = "", fileext = ".png")
outout_file_proc <- paste("C:\", Sys.getenv("USERNAME"), "_ ".pptx", sep = "")
df <- mtcars
x <- plot_ly() %>% add_markers(data=mtcars, x=~wt, y=~disp)
saveWidget(x, "temp.html")
webshot("temp.html", temp_file_proc)
doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with(x = doc, value = "Title of the PPT", location = ph_location_type(type = "title"))
image_add <- external_img(temp_file_proc, width = 5, height = 5)
doc <- ph_with(x = doc, image_add,
location = ph_location(left = 2.5, top = 2), use_loc_size = FALSE)
print(doc, target = outout_file_proc)