layout_properties(x = my_pres,布局=“比较”,主=“ Office主题”) 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主题比较主体3文本占位符2 0.3927734 1.2583486 20 Office主题比较dt 7日期占位符6 0.3927734 5.2135422 25办公室主题比较ftr 8页脚占位符7 3.3125000 5.2135422 30 Office主题比较sldNum 9幻灯片编号占位符8 7.3553718 5.2135422 34 Office主题比较标题2标题1 0.392773
找不到格式化这种格式的好方法,但是如您所见,类型主体的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中的错误(类型=类型,索引=索引): 正文只能有6个元素,但索引设置为11
但是不确定为什么会发生这种情况,因为身体类型的ID分别为11和13
谢谢!