【发布时间】:2022-01-24 09:54:28
【问题描述】:
我正在使用Officer 创建一个Power Point 演示文稿。假设我使用来自 blank.pptx 的 for 循环创建了 10 页幻灯片(名为 10_slides_ppt.pptx)。
我的问题是,有没有办法可以在位置编号为 c(3, 6, 9) 的幻灯片之前添加一张幻灯片?
最终的ppt会是这样的:
1, 2, (新幻灯片 1), 3, 4, 5, (新幻灯片 2), 6, 7, 8, (新幻灯片 3), 9, 10
代码:
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"))
【问题讨论】: