I am creating a Power Point presentation using Officer. Let's say I have created a 10 pages slides (named 10_slides_ppt.pptx
) using for loop from a blank.pptx
.
My question is, is there a way that I can add one slide before slides with position number of c(3, 6, 9)
?
The final ppt will like this:
1, 2, (new slide 1), 3, 4, 5, (new slide 2), 6, 7, 8, (new slide 3), 9, 10
Code:
library(officer)
current_pres <- read_pptx('10_slides_ppt.pptx')
# To add new slide 1, but I don't know how to set position of slide
final_pres <- add_slide(current_pres, layout = "Title and Content", master = "Office Theme") %>%
ph_with(current_pres, value = "heading", location = ph_location_type(type = "title")) %>%
add_slide(current_pres, layout = "Title and Content", master = "Office Theme") %>%
ph_with(current_pres, value = "heading", location = ph_location_type(type = "title")) %>%
add_slide(current_pres, layout = "Title and Content", master = "Office Theme") %>%
ph_with(current_pres, value = "heading", location = ph_location_type(type = "title"))