Open rich-iannone opened 6 years ago
This relates to a user issue posted in https://github.com/rstudio/rmarkdown/issues/1419, which is now closed in favor of the issue here.
What is the solution for this issue? I couldn't find any solutions following the threads here. Appreciate any advice. Thanks.
I have a work template that contains images.
When I use rstudio/rmarkdown/pandoc to output a powerpoint presentation using this template (via reference_doc in YAML header), I get the error message that powerpoint found a problem with content in... powerpoint can attempt to repair the presentation.
When I repair it, it says, "PowerPoint couldn't read some content in..." however, the slide deck still mostly renders. Weirdly, the images still render with a tiny red x and an error message saying, "The picture can't be displayed" over the top of the image. Like this:
and this:
If I don't use the template, the presentation renders without any error messages.
I am using pandoc version 2.5, R 3.5.1, rmarkdown 1.11, rstudio preview 1.2.1206. This behavior occurs in both windows and macOS X environments.
Hello,
I am also seeing this, but the overlaid image placeholder says: "To help protect your privacy, Powerpoint has blocked automatic download of this picture." I also note that the overlay is on the actual slide, while the correctly displayed image is part of the slide master as expected.
Running on linux with R 3.5.2, rmarkdown 1.11 and Pandoc 2.5 (no RStudio involved).
Cheers,
Bernhard
Any suggestions for a workaround to this?
Probably create two same templates except that one doesn’t have background pictures. Using the one without background pictures in R and switch to the other template in PowerPoint.
Kind regards,
Junwei
On 12 Feb 2019, at 12:06 PM, Matt Cowgill notifications@github.com wrote:
Any suggestions for a workaround to this?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
I've found a hacky workaround by deleting the
For the above example, in <unzipped-pptx-dir>/ppt/slides/slide1.xml
there is
just delete it.
In R, this works for me
## generate pptx
rmarkdown::render("pwrpnt.md", output_format = "powerpoint_presentation")
## unzip it
unzip("pwrpnt.pptx", exdir = "unzipped-pptx")
### remove the <p:pic> section and write back out
doc <- xml2::read_xml("unzipped-pptx/ppt/slides/slide1.xml")
xml2::xml_remove(xml2::xml_find_all(doc, "/p:sld/p:cSld/p:spTree/p:pic"))
xml2::write_xml(doc, "unzipped-pptx/ppt/slides/slide1.xml")
## zip it back up
wd <- getwd()
setwd("unzipped-pptx")
zip::zip(zipfile = file.path(wd, "out.pptx"), files = list.files(recursive = TRUE, include.dirs = FALSE, all.files=TRUE))
setwd(wd)
## clean up
file.copy("out.pptx", "pwrpnt.pptx", overwrite = TRUE)
unlink("out.pptx", recursive = TRUE)
unlink("unzipped-pptx", recursive = TRUE)
thanks @awalker89 - that's really useful. It's annoying to have to use this workaround but I'm glad you've come up with one
Hi, I was able to workaround this issue by using the background settings of the master slide (Title Slide) instead of doing a copy/paste.
Slide master with the issue > right click > format background. Fill with Picture or texture fill > select your background file
@lm-bsl Seems to be the correct solution from PPT perspective. Thanks for sharing. In my case, it won't work, unfortunately, because I have a master slide with a graphic and a gradient.
The full minimal reproducible example can be downloaded here: test.zip
pwrpnt.md:
template.potx is within the zip file (cannot be attached here).
The following is run at command line (with pandoc 2.2.1):
Here's a screenshot of the output .pptx (where I dragged the second image frame to the lower right):
The issue is the non-necessary image (which cannot find the image anyway) that appears in the same position as the image in the master slide. The user can manually delete those extra image frames though.