首页 > 解决方案 > R官员包:当有多个几乎相同的占位符时如何指定某个占位符

问题描述

我在 Powerpoint 幻灯片上使用 R 官员包,我需要将文本插入到 5 个相同的占位符中,所有这些占位符在幻灯片底部彼此相邻。在不推荐使用 ph_with_text 函数之前,可以使用 body 和 index 参数来准确指定要插入文本的占位符。但是,我找不到使用较新的 ph_with 函数正确执行此操作的方法。

对于上下文,textholders 的 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")

但是我对中间的 3 感到很困惑——我该如何指定这些占位符?有什么办法可以更改它们的 ph_label,使它们不都是“文本占位符 24”吗?

标签: rpowerpointofficer

解决方案


解决方案是在 PowerPoint 的主模板视图中按下Alt + F10Home > Arrange > Selection Pane按照 Bernardo 的建议,您也可以通过 访问此菜单。这将打开模板中所有元素的标签,双击允许您重命名它们。然后你可以在officer中使用你的自定义标签

ph_with(location = ph_location_label(ph_label = "Custom Label"), value = "Blah blah")

推荐阅读