report_save
report_save(doc, path=None)Save a report to disk.
Writes a deck or document built with report_new() and the report_* verbs, and returns the path it used. The format follows the document, not the file name: a deck writes .pptx and a Word document writes .docx, which is why path may be left out entirely.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| doc | pptx.Presentation or docx.Document | A document from report_new(). |
required |
| path | str | Output file path (.pptx or .docx). None (default) writes report.pptx / report.docx. A bare file name lands in ezrsurvey-outputs/ (created on demand); a path naming a directory (“./x.pptx”, “charts/x.pptx”, anything absolute) is used exactly as given. See the output_dir option. |
None |
Returns
| Name | Type | Description |
|---|---|---|
| str | The path written. |
See Also
report_new, report_deck
Examples
>>> import tempfile, os
>>> path = os.path.join(tempfile.mkdtemp(), "deck.pptx")
>>> report_save(report_add_slide(report_new("pptx"), "Hi"), path)