officer icon indicating copy to clipboard operation
officer copied to clipboard

plot_layout_properties(): current slide's layout as default, layout id as selector, add ph ids to plot

Open markheckmann opened this issue 5 months ago • 0 comments

I have three feature suggestions concerning plot_layout_properties()

@davidgohel Please let me know if these suggestions appear sensible to you and I will be happy to implement them.


1. Use current slide as default layout

Currently, plot_layout_properties() requires the layout arg to be supplied. In my workflow, however, I often want to plot the layout of the slide I just added. Instead of having to enter its full name again, it would be convenient if plot_layout_properties() used the current slide's layout as a default for plotting (if layout is NULL). Then one could simply do the following, which is nice when working with officer interactively.

x <- read_pptx() |> add_slide("Title Slide", "Office Theme")
x |> plot_layout_properties()

An alternative to this approach, there could be a new function plot_slide() that plots the current slide.

2. Allow layout index as alternative to the layout name

It would be convenient to be able to use the layout's id (always shown when printing the rpptx object) as an alternative to the layout's name for the parameter layout. So one could just do:

x <- read_pptx()
x |> plot_layout_properties(1)
x |> plot_layout_properties(2)

This makes it very quick to flip throught the layouts.

3. Add placeholder id to plot

It would be helpful to optionally show the placeholder's id (column id from layout_properties(), i.e. the placeholder's shape id) in the plot. ph_location_type(), for example, has the id argument to disambiguate between placeholders of the same type. Showing the ph id in the plot will make it easier for the user to see which ph is which.

It could look like this, with the ph id in the upper right corner, for plot_layout_properties(x, id = TRUE).

image

markheckmann avatar Aug 30 '24 08:08 markheckmann