-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make use of the term id
consistent across functions layout_properties(), ph_location_type(), and plot_layout_properties()
#606
Comments
Hi OK with your propositions 1, 2, 3 and 4. |
markheckmann
added a commit
to markheckmann/officer
that referenced
this issue
Sep 13, 2024
- plots layout name, ph id, ph type + index by default now (davidgohel#606). - also rammar correction in docs: 'functions for reading presentation information' => remove s
markheckmann
added a commit
to markheckmann/officer
that referenced
this issue
Sep 14, 2024
- plots layout name, ph id, ph type + index by default now (davidgohel#606). - also rammar correction in docs: 'functions for reading presentation information' => remove s
markheckmann
added a commit
to markheckmann/officer
that referenced
this issue
Sep 18, 2024
`ph_location_id()`is a new member in the `ph_location_*` family. It references a placeholder via its unique id (davidgohel#606)
|
FYI, I did ran a revdepcheck ans all IS ok (~65 dep. Packages). So far so good |
davidgohel
pushed a commit
that referenced
this issue
Sep 23, 2024
…amily `ph_location_id()`is a new member in the `ph_location_*` family. It references a placeholder via its unique id (#606)
Suggestion 4 commited in PR #609 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @davidgohel ,
the different usages of the term/argument
id
acrosslayout_properties()
,ph_location_type()
, andplot_layout_properties()
got me confused at first (and maybe others too). You also referred to its use inph_location_type()
as a design error here. For this reason, I would like to suggest the changes at the bottom.Please let me know what you think. I am happy to PR :)
SITUATION
NB: The following comprehensive elaborations serve to document the current state and to help my own understanding.
Currently, the notion of
id
regarding phs is slightly ambiguous. There are several places whereid
is used with different meanings.layout_properties()
: returns anid
column, with a unique id for each placeholder. The id is unique across a slide/layout, starts at 2, but is not necessarily consecutive (see technical note below). The value cannot be changed by the user. It is assigned by PowerPoint when a new placeholder is added to a layout.plot_layout_properties()
: withlabels = FALSE
plots anid
for each placeholder. Theid
in the plot, however, has a different meaning than in thelayout_properties()
output despite the similar function names. Here,id
is a generated sequential index number along phs of the same type (e.g. body).ph_location_type()
: the argumentid
here has the same meaning as inplot_layout_properties()
. It is used for disambiguation between placeholders of the same type (e.g. body)Suggestions
To harmonize the use of the term
id
across functions, I suggest the following changes:layout_properties()
:id
remains the unique identifier for a placeholder. IMO, this is what a user would probably expect when reading the term "id". The output gains a newtype_idx
column.type
+type_index
make it very clear what they refer to.p:cNvPr
node'sid
attribute. This node and the placeholder are both children of a shape (most common), group shape, graphic frame, etc. According to the specs (ECMA-376, Part 1, p. 2570), the id attribute must be unique on a slide to be OOXML conformant. (NB: id = 1 is reserved for the main slide's background shape, so added objects start at id=2). As not all shapes etc. in a layout necessarily contain a placeholder, the id may be non-consecutive.ph_location_type()
: arg name changes fromid
toidx
(ortype_idx
) to make clear it is anindex and not the
id
column fromlayout_properties()
. Theid
arg will raise a deprecation warning, but will be preserved alongsideidx
(or similar) for several versions.plot_layout_properties()
: the plot contains all relevant ph information, i.e. labels (red), type + type_idx (blue), unique id (green, i.e. columnid
fromlayout_properties()
). New argstype = T/F
andid = T/F
. The output fromplot_layout_properties(x, "Two Content", labels = T, type = T, id = T, title = T)
could then look like this.ph_location_id()
: This one takes the "true" phid
as returned bylayout_properties()
to reference a placeholder. I consider this a nice addition to theph_location_*
family. It would also come in handy for the use case we discussed before (NB: it's of course also solvable via the type + type_idx combination you suggested, but would be a handy alternative.). For quick interactive development, I would also like using an id and not typing out the label or type + id (index) combo.The text was updated successfully, but these errors were encountered: