placeholder.RdObject to define placeholders.
ref_placeholder(
label = "",
label_match = c("match", "exact"),
label_from = c("slide", "layout"),
type = c("body", "title", "ctrTitle", "ftr", "subTitle", "tbl", "chart", "img", "any"),
tie_breaker = c("largest", "smallest", "left", "right", "top", "bottom"),
replace = TRUE,
error_call = current_env()
)
new_placeholder(
type = c("body", "title", "ctrTitle", "ftr", "subTitle", "tbl", "chart", "img"),
x_offset = "10%",
y_offset = "20%",
width = "80%",
height = "60%",
label = "",
error_call = current_env()
)The placeholder label to select. ref_placeholder allows to
pass a pattern to search with if label_match is set to "match".
Use "match" if label is a regex pattern, or "exact"
for exact match
Which placeholder label should be used, the one listed in the "slide" or from the "layout". Generally new slides should use "layout", while updating a slide may use either. Listing both allows to check the first listed location then the other before declaring it cannot find it.
The type of placeholder. Options are "body", "title", "ftr",
"subTitle", "tbl", "chart", "img".
ref_placeholder() allows for "any" in
this position to allow for referencing any type of placeholder, or any
combination of to be types to be passed. new_placeholder() allows only
one.
Which pane to select when multiple are returned from label matching ("largest","left","right","top","bottom"). can pass multiple to clarify if there are ties remaining.
Identify whether to replace the existing placeholder or not if it exists on the slide. defaults to TRUE
The execution environment of a currently
running function, e.g. caller_env(). The function will be
mentioned in error messages as the source of the error. See the
call argument of abort() for more information.
x offset in centimeters (cm), inches (in), or percent(in) of slide width
y offset in centimeters, inches, or percent of slide height
Width in centimeters, inches, or percent of slide width
Height in centimeters, inches, or percent of slide height
A placeholder object
ref_placeholder() defines what logic to apply when figuring out which a
placeholder in a slide or layout to use to insert content.
new_placeholder() defines what logic to use when creating a
new placeholder in a slide.
empty_placeholder() indicates that the content
should not be added to the slide, and does not expect any content.
# reference placeholder, find the top-most placeholder in the slide or layout
# with the word "title" in the placeholder label where type is "title" and
# replace the contents when new values are inserted
ref_placeholder(
label = "[Tt]itle",
type = "title",
tie_breaker = "top",
label_from = c("slide","layout"),
replace = TRUE
)
#> ── reference placeholder with settings: ───────────────────────────────────────
#> List of 6
#> $ type : chr "title"
#> $ label : chr "[Tt]itle"
#> $ label_from : chr [1:2] "slide" "layout"
#> $ label_match: chr "match"
#> $ tie_breaker: chr "top"
#> $ replace : logi TRUE
# reference placeholder, find the the exact placeholder with the label "Content Placeholder 5"
# based on the template layout
ref_placeholder(
label = "Content Placeholder 5",
label_match = "exact",
label_from = "layout"
)
#> ── reference placeholder with settings: ───────────────────────────────────────
#> List of 6
#> $ type : chr [1:9] "body" "title" "ctrTitle" "ftr" ...
#> $ label : chr "Content Placeholder 5"
#> $ label_from : chr "layout"
#> $ label_match: chr "exact"
#> $ tie_breaker: chr [1:6] "largest" "smallest" "left" "right" ...
#> $ replace : logi TRUE
# Create a new placeholder 20% down from the top of the slide, 10% off from the left side, and
# make it 10cm tall and 15cm wide
new_placeholder(
x_offset = "10%",
y_offset = "20%",
height = "10cm",
width = "15cm"
)
#> ── new placeholder with settings: ─────────────────────────────────────────────
#> List of 6
#> $ label: chr ""
#> $ type : chr "body"
#> $ offx : chr "10%"
#> $ offy : chr "20%"
#> $ cx : chr "5.90551181102362"
#> $ cy : chr "3.93700787401575"