'How can I import an external slide in powerpoint with officer in R?

I want to copy the content of two slides from two pptx files into one pptx file using officer in R.

I thave started with the following code:

slide1 = read_pptx('1.pptx') 
slide2 = read_pptx('2.pptx') 
slide2_content = slide2 %>% slide_summary() 

Now - how do I get all content from slide2 attached to slide1 and save it to a new file?



Solution 1:[1]

I have found a 'backwards' work-around:

my_pres <- read_pptx(path = "one_slide.pptx") # The pptx can have any number of slides
my_pres <- add_slide(my_pres)
my_pres <- ph_with(my_pres, "Hello world", location = ph_location_type(type = "title"))
move_slide(my_pres, 1,length(my_pres))
print(my_pres, target = 'one_slide_appended.pptx')

but this limits to including slides from a single source

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1