Adds one slide on the section layout role ("Section Header" in
basic.pptx) with a title and text. That layout has no subtitle
placeholder: a subtitle is placed in the text box, above text, so
speclayouts written for templates that do have a subtitle keep all their
text. This backs the section placeholder type:
Usage
append_section_slides(
doc_o,
title = NULL,
subtitle = NULL,
text = NULL,
section_title = NULL,
to_page = NA,
doc_original = NULL,
save_file = FALSE,
layouts = placeholder_layouts(),
metadata = NULL,
role = "section"
)Arguments
- doc_o
Path to the
.pptxfile. Read whendoc_originalisNULL, and used to name the saved file.- title, subtitle, text
Text for the slide. Each may be a character vector or a list, one paragraph per element.
NULLleaves it out.- section_title
Older name for
title, used whentitleisNULL.- to_page
Page for the first slide; the others follow it.
NAappends after the last slide.- doc_original
An optional
officer::rpptxobject to add to.- save_file
If
TRUE, the deck is saved next todoc_owith a_<type>suffix.- layouts
The role lookup, see
placeholder_layouts().- metadata
Optional named
listof values for{token}s in the text, seeapply_tokens().- role
The layout role to use.
See also
append_section_header_slides() for the older title-only version.
Examples
deck <- tempfile(fileext = ".pptx")
print(officer::read_pptx(system.file("theme/basic.pptx", package = "autoslider.core")), deck)
doc <- append_section_slides(deck, title = "Safety", subtitle = "Data cut-off: 01-JAN-2026")
officer::slide_summary(doc, index = length(doc))$text
#> [1] "Safety" "Data cut-off: 01-JAN-2026"