R Officer包:如何在存在多个近似相同的占位符时指定特定的占位符

8

我正在使用R officer包在Powerpoint幻灯片中,需要将文本插入5个相同的占位符中,这些占位符都位于幻灯片底部一排中相邻的位置。在ph_with_text函数被弃用之前,可以使用body和index参数来指定要插入文本的确切占位符。然而,我无法找到一种正确使用较新的ph_with函数的方法。

为了上下文,textholder的layout_properties如下:

type id    ph_label             offx      offy       cx       cy
body 25    Text Placeholder 24  2.4526826 5.9722200  1.340278 0.7065978
body 26    Text Placeholder 24  4.2022332 5.9722200  1.340278 0.7065978
body 27    Text Placeholder 24  5.9965278 5.9722211  1.340278 0.7065978
body 28    Text Placeholder 24  7.7013342 5.9722200  1.340278 0.7065978
body 29    Text Placeholder 24  9.4496063 5.9722200  1.340278 0.7065978

如果我使用ph_location_label,我只能指定第一个位置,像这样:

ph_with(location = ph_location_label(ph_label = "Text Placeholder 24"), value = "Blah blah"

我可以使用position_right参数来指定最后一个位置:
ph_with(location = ph_location_type(type = "body", position_top = F, position_right = T), value = "Blah blah")

但是我在中间的三个位置上遇到了困难 - 我该如何指定这些占位符?有没有办法更改它们的ph_label,使其不都是“文本占位符24”?


也遇到了同样的问题。希望有人能够澄清如何使用ID。 - Bernardo
请看我在@Bernardo的回答。 - Ljupcho Naumov
1个回答

5
解决方法是在PowerPoint的主模板视图中按下 Alt + F10。您也可以通过 首页 > 排列 > 选择窗格 访问此菜单,如 Bernardo 所建议的那样。这将打开模板中所有元素的标签,双击可对其进行重命名。然后您可以在 officer 中使用自定义标签。
ph_with(location = ph_location_label(ph_label = "Custom Label"), value = "Blah blah")

1
没错。这就是我在 macOS 中手动找到相同窗口的方法:Home > Arrange > Selection Pane。太难找和记住了,但就是这样!谢谢。 - Bernardo
我只知道这个快捷键!我也会在答案中更新这个信息。在Windows和Mac上都是一样的。 - Ljupcho Naumov

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接