Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Officer Package: How to specify a certain placeholder when there are multiple nearly identical ones

I'm using the R officer package on a Powerpoint slide where I need to insert text into 5 identical placeholders, all next to each other in a row along the bottom of the slide. Before the ph_with_text function was deprecated, it was possible to use the body and index arguments to specify exactly which placeholder you wanted to insert text into. However, I cannot find a way to do this properly with the newer ph_with function.

For context, the layout_properties of the textholders are as below:

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

If I use ph_location_label, I can only specify the first one, like so:

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

I can use a position_right location argument to specify the last one:

ph_with(location = ph_location_type(type = "body", position_top = F, position_right = T), value = "Blah blah")

But I'm pretty stuck for the middle 3 - how can I specify these placeholders? Is there any way I can change the ph_label of them so they're not all "Text Placeholder 24"?

like image 403
PlanWithAMan Avatar asked Oct 27 '22 06:10

PlanWithAMan


1 Answers

The solution is pressing Alt + F10 in the master template view in PowerPoint. You can also get to this menu by Home > Arrange > Selection Pane, as suggested by Bernardo. This will open the labels for all elements in the template and double clicking allows you to rename them. Then you can use your custom labels in officer with

ph_with(location = ph_location_label(ph_label = "Custom Label"), value = "Blah blah")
like image 54
Ljupcho Naumov Avatar answered Nov 02 '22 05:11

Ljupcho Naumov