0

layout_properties ( x = my_pres, layout = "Comparison", master = "Office Theme" ) master_name 名称类型 id ph_label ph offx offy 3 Office 主题比较正文 13 文本占位符 12 5.0625000 4.8298611 9 Office 主题比较正文 4 内容占位符 3 0.3927734 1.7009799 11 Office 主题比较正文 11 文本占位符 10 0.3923611 4.8290453 12 Office 主题比较正文 6 内容占位符 5 5.0625000 1.7009799 15 Office 主题比较正文 5 文本占位符 4 5.0625011 1.2482754 16 Office Theme Comparison body 3 Text Placeholder 2 0.3927734 1.2583486 20 Office Theme Comparison dt 7 Date Placeholder 6 0.3927734 5.2135422 25 Office Theme Comparison ftr 8 Footer Placeholder 7 3.3125000 5.2135422 30 Office Theme Comparison sldNum 9 Slide Number Placeholder 8 7.3553718 5.2135422 34 Office Theme Comparison标题 2 标题 1 0.3927732135422 30 Office 主题比较 sldNum 9 幻灯片编号占位符 8 7.3553718 5.2135422 34 Office 主题比较标题 2 标题 1 0.3927732135422 30 Office 主题比较 sldNum 9 幻灯片编号占位符 8 7.3553718 5.2135422 34 Office 主题比较标题 2 标题 1 0.392773

找不到格式化 thsi 的好方法,但您可以看到类型主体的 id 为 13。

现在,当我尝试将其编码为:

GSK_Comparison <- function(PP,title,sub1,sub2,footer, table1,table2){
  PP <- PP %>% 
    add_slide(layout = "Comparison", master = "Office Theme") %>%
    ph_with_text(type = "title", str = title) %>%
    ph_with_text(type = "body",index = 11, str = sub1) %>%
    ph_with_flextable(value = table1,type= "body",index = 4) %>%
    ph_with_text(type = "body",index = 13, str = sub2) %>%
    ph_with_flextable(value = table2, type = "body", index = 6) %>%
    ph_with_text(type = "dt", str = format(Sys.Date())) %>%
    ph_with_text(type = "ftr",str = footer)
}

我收到以下错误消息: slide$get_location(type = type, index = index) 中的错误:body 只能有 6 个元素,但索引设置为 11

但不确定为什么会发生这种情况,因为很明显,身体类型有 11 和 13 的 ID

提前致谢!

4

0 回答 0