Skip to content

feat: more consistency => deprecate position_right and position_top in ph_location_type() or change defaults? #687

@markheckmann

Description

@markheckmann

Should we deprecate the args position_right and position_top in ph_location_type() or change the defaults for more conistency?


Reasoning

Currently, the behaviour of ph_location_type("body") and phs_with(body = ..) is somewhat inconsistent.

  • ph_location_type()'s default is position_right = TRUE. Hence, it will use the body ph on the right.
  • phs_with(), however, uses type_idx = 1, if not explicitly specified.

The code below uses ph type body with the defaults in both cases.

library(officer)
library(doconv)

read_pptx() |> 
  add_slide("Two Content") |> 
  ph_with("<ph_location_type>", ph_location_type("body")) |> 
  phs_with(body = "<phs_with>") |> 
  print(tempfile(fileext = ".pptx")) |> 
  to_miniature(fileout = "tmp.png")

Created on 2025-09-03 with reprex v2.1.1

Should we make this more consistent? There are several options:

  • Do you see a necessity to keep the two args position_right and position_top in the long run? I think with type_idx, there is an easy to understand mechanism to choose a ph if there are several of the same type. Also, position_right and position_top fall short for more than 4 body phs.
  • If you find them useful, we might consider changing the defaults, i.e. position_right and position_topare NULL and optional, while the default is type_idx = 1.

Let me know what you think :)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions