Creates a report slide and populates the content
Arguments
- obnd
onbrand report object
- template
Name of slide template to use (name from templates in yaml mapping file)
- elements
Content and type for each placeholder you wish to fill for this slide: This is a list with names set to placeholders for the specified template. Each placeholder is a list and should have a content element and a type element (see Details below).
- verbose
Boolean variable when set to TRUE (default) messages will be displayed on the terminal; Messages will be included in the returned onbrand object.
Value
onbrand report object with either the content added or isgood set to FALSE with any messages in the msgs field. The isgood value is a Boolean variable indicating the current state of the object.
Details
For example consider the mapping information for the slide
template title_slide
with the two place holders title
and
subtitle
.
rpptx:
master: Office Theme
templates:
title_slide:
title:
type: ctrTitle
index: 1
ph_label: Title 1
content_type: text
subtitle:
type: subTitle
index: 1
ph_label: Subtitle 2
content_type: text
This shows how to populate a title slide with text:
obnd = report_add_slide(obnd,
template = "title_slide",
elements = list(
title = list( content = "Slide Title",
type = "text"),
subtitle = list( content = "Subtitle",
type = "text")))
See the function add_pptx_ph_content
for a list of
allowed values for type
. Note that if mapping defines the
content_type
as text
, you cannot use a list
type.
Similarly, if the content_type
is defined as list
, you
cannot use a text
type.
Examples
obnd = read_template(
template = file.path(system.file(package="onbrand"), "templates", "report.pptx"),
mapping = file.path(system.file(package="onbrand"), "templates", "report.yaml"))
obnd = report_add_slide(obnd,
template = "content_text",
elements = list(
title = list( content = "Text Example",
type = "text"),
sub_title = list( content = "Adding a slide with a block of text",
type = "text"),
content_body = list( content = "A block of text",
type = "text")))