I am trying to produce some powerpoint reports with OfficeR, but am having trouble saving the results to a file.
I am able to process the data and fill the placeholders. The content that is intended for the placeholders is shown when I use slide_summary()
, but it is not visible in the output file.
My code looks like this:
# read template
pptx <- read_pptx("sample_pptx.pptx")
# open slide 5
slide <- on_slide(pptx, 5)
# add text to pre-existing placeholder
ph_add_text(slide, str = "sample_text", ph_label = "sample_ph")
# check content of slide
slide_summary(slide)
# save presentation
print(pptx, target = "outfile.pptx")
Output:
> slide_summary(slide)
type id ph_label offx offy cx cy text
1 body 2 sample_ph NA NA NA NA sample_text
> print(pptx, target = "outfile.pptx")
[1] "C:/Users/mhuber/OfficeR/outfile.pptx"
What ever I do, the text never shows up in my outfile.