report_add_slide

report_add_slide(doc, title=None, layout=None, master=None, heading_level=1)

Add a slide (PowerPoint) or heading (Word) to a report.

For a pptx document this starts a new slide and sets its title; for a docx document it adds a heading paragraph. 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.

Parameters

Name Type Description Default
doc pptx.Presentation or docx.Document A document from report_new(). required
title str Slide title / heading text. None
layout str PowerPoint layout and master names. None (default) picks the template’s best content layout automatically. Name a layout from report_layouts() to override. None
master str PowerPoint layout and master names. None (default) picks the template’s best content layout automatically. Name a layout from report_layouts() to override. None
heading_level int Word heading level (1-3). Default 1. 1

Returns

Name Type Description
pptx.Presentation or docx.Document The document.

See Also

report_new, report_layouts

Examples

>>> doc = report_add_slide(report_new("pptx"), "Audience")