
Add a slide (PowerPoint) or heading (Word) to a report
Source:R/report_officer.R
report_add_slide.RdFor a pptx document this starts a new slide and sets its title; for a
docx document it adds a heading paragraph.
Arguments
- doc
A document from
report_new().- title
Optional slide title / heading text.
- layout, master
PowerPoint layout and master names.
NULL(default) picks the template's best content layout automatically (by inspecting placeholders, so corporate templates with renamed layouts work). Name a layout fromreport_layouts()to override.- heading_level
Word heading level (1-3). Defaults to
1.
Details
Automatic selection scores every layout of the template: a title placeholder plus a single content placeholder is the ideal, and the layout's placeholders decide – not its (language-dependent) name. If the chosen layout has no title placeholder, the title is skipped with a warning rather than failing the build.
Examples
doc <- report_new("pptx") %>% report_add_slide("Audience")
class(doc)
#> [1] "rpptx"