dbs_annotator.utils.report_chart_utils.add_chart_to_doc

dbs_annotator.utils.report_chart_utils.add_chart_to_doc(doc, png_bytes, *, heading=None, heading_level=2, width_inches=None, fallback_message='Chart generation error.')[source]

Insert a PNG chart into a Word document.

Parameters:
  • doc (Document) – python-docx Document instance

  • png_bytes (bytes | None) – raw PNG bytes (or None on failure)

  • heading (str | None) – optional heading text above the chart

  • heading_level (int) – heading level (default 2)

  • width_inches (float | None) – image width in the document (None for full page width)

  • fallback_message (str) – text shown if png_bytes is None