尝试在add_Slide内的PowerPoint中使用自己的母版时出错

时间:2018-11-21 17:13:45

标签: officer

因此,当仅使用标准内置布局和母版时,以下工作摘自文档:

doc <- read_pptx() %>%
  add_slide(layout = "Two Content", master = "Office Theme") %>%
  ph_with_text(type = "body", str = "A first text", index = 1) %>%
  ph_with_text(type = "body", str = "A second text", index = 2) %>%
  ph_with_text(type = "title", str = "A title") %>%
  ph_with_text(type = "ftr", str = "Slide footer") %>%
  ph_with_text(type = "dt", str = format(Sys.Date()))
print(doc, target = "first_example.pptx") 

但是,当我使用自己的Powerpoint时:

my_pres1 <- read_pptx("GSK_PP.pptx") 
my_pres1 <-add_slide(my_pres1,layout = "Image and Text", master = "GSK")
layout_summary(my_pres1)
layout_properties ( x = my_pres1, layout = "Image and Text", master = "GSK" )

我收到以下错误消息:

my_pres1 <-add_slide(my_pres1,layout = "Image and Text", master = "GSK")
Error in add_slide(my_pres1, layout = "Image and Text", master = "GSK") : 
  could not find layout named 'Image and Text' in master named 'GSK'

当我运行版式(摘要)时,版式位于主GSK下,我尝试了多种版式和添加幻灯片的方法,但这是行不通的。

这就是我在运行布局属性时得到的,这对我来说似乎不正确,因此我不太确定在这种情况下该怎么做:

layout_properties ( x = my_pres1, layout = "Image and Text", master = "GSK" )
[1] master_name name        type        id          ph_label    offx       
[7] offy        cx          cy         
<0 rows> (or 0-length row.names)

关于如何使用我自己的PowerPoint幻灯片来创建更多幻灯片的任何反馈或建议,我们将不胜感激。 预先感谢

0 个答案:

没有答案