davidgohel / rvg

https://davidgohel.github.io/rvg/
132 stars 15 forks source link

ph_with_vg causes error in pptx #14

Closed rlusch closed 7 years ago

rlusch commented 7 years ago

When trying to create a powerpoint using ph_with_vg, the powerpoint is created, but has massive error when opening. image image

Here is some code I was able to put together to recreate my problem.

require(ggplot2)
require(officer)
require(rvg)
require(magrittr)
require(forecast)

gg <- autoplot(ts(1:24, start = c(2016, 1), f = 12))

my_pres <- read_pptx() %>% 
  add_slide(layout = "Title and Content", master = "Office Theme") %>%
  ph_with_text(type = "title", str = "A title") %>%
  ph_with_vg(code = plot(1:24), type = "body")  %>%
  #ph_with_vg(code = print(gg), type = "body") %>%
  #ph_with_text(type = "body", str = "And content") %>%
  print(target = "test_no_template.pptx")

The lines that have been noted out were used to make sure that I could still add text into that portion of the powerpoint, which I could, and that the issue was also happening with ggplot, which it is.

This occurred on a Windows 7 installation, using R version 3.4.2 (32-bit), officer version 0.1.8, Rcpp 0.12.13, and rvg version 0.1.4.

Please let me know if there is anything I can do to help resolve the issue.

davidgohel commented 7 years ago

Maybe a constraint on rvg version I should write...

Could you try with:

  1. rvg 1.6 from CRAN

If still not working with:

  1. rvg and officer from Github
rlusch commented 7 years ago

I thought I had an updated version of rvg, I updated to 1.6 and it worked as expected. By the way, you got to this issue VERY fast! Thank you!

davidgohel commented 7 years ago

:)

yes, too fast, I have lot of documents to scan right now and I think I am unconsciously trying to avoid these scans...