docx/basic-list-smartart

A document carrying a SmartArt diagram treated as a 'list'-family graphic. The diagram is projected onto the page as a <w:drawing> whose graphic references a <dgm:relIds> block, which resolves via the document's relationships to per-diagram parts under word/diagrams/ (data1.xml, layout1.xml, colors1.xml, quickStyle1.xml, drawing1.xml).

Library verdicts: python-docx: — docxjs: —

Metadata

Feature iddocx/basic-list-smartart
Formatdocx
Categoryimages
Spececma-376-5-part-1 § 21.4 dgm:dataModel

XPath assertions

ID / partPredicateXPathpython-docxdocxjs
diagram-data-part-present
word/diagrams/data1.xml
exist
The package must contain a `word/diagrams/data1.xml` part whose root element is <dgm:dataModel>. This part holds the SmartArt's logical shape and is the anchor the reader uses to detect that a SmartArt diagram is present.
/dgm:dataModel
diagram-data-relationship-present
word/_rels/document.xml.rels
exist
The document's relationships part must carry at least one relationship of type `diagramData`, binding the body's drawing to its data1.xml.
//rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData']

Render assertions

No render assertions declared.

Generator source

scripts/gen_basic_list_smartart.py

#!/usr/bin/env python3
"""Generate ``fixtures/docx/basic-list-smartart.docx``.

Uses python-docx's ``Document.add_smart_art("list")`` authoring API (added in
python-docx 2026.05.7) to build a SmartArt diagram of the built-in ``list1``
layout family from scratch. The diagram is populated with three content
nodes so the fixture exercises the full four-part SmartArt authoring
surface (``data1.xml``, ``layout1.xml``, ``colors1.xml``, ``quickStyle1.xml``)
plus the four document-part relationships.

Previously this generator copied bytes from a Word-authored fixture in the
python-docx test corpus because python-docx had no SmartArt authoring API.
W10-A wave added that API and removed the "degraded" dependency on an
external fixture source.
"""

from __future__ import annotations

from pathlib import Path

from docx import Document

_REPO_ROOT = Path(__file__).resolve().parent.parent
_OUT = _REPO_ROOT / "fixtures" / "docx" / "basic-list-smartart.docx"


def main() -> int:
    document = Document()
    smart_art = document.add_smart_art("list")
    smart_art.add_node("Alpha")
    smart_art.add_node("Beta")
    smart_art.add_node("Gamma")
    _OUT.parent.mkdir(parents=True, exist_ok=True)
    document.save(str(_OUT))
    print(_OUT)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

Manifest (expanded)

{
  "$schema": "../manifest.schema.json",
  "id": "docx/basic-list-smartart",
  "title": "Basic list SmartArt",
  "format": "docx",
  "category": "images",
  "summary": "A document carrying a SmartArt diagram treated as a 'list'-family graphic. The diagram is projected onto the page as a <w:drawing> whose graphic references a <dgm:relIds> block, which resolves via the document's relationships to per-diagram parts under word/diagrams/ (data1.xml, layout1.xml, colors1.xml, quickStyle1.xml, drawing1.xml).",
  "roles": [
    "authoring"
  ],
  "spec": {
    "source": "ecma-376-5-part-1",
    "clause": "21.4",
    "element": "dgm:dataModel",
    "rnc_reference": "spec/ecma-376-5/part-1/rnc/DiagramML.rnc",
    "xsd_reference": "spec/ecma-376-5/part-1/xsd/dml-diagram.xsd",
    "notes": "SmartArt is not a single element — it is a five-part authoring surface (data / layout / colors / quickStyle / drawing) bound to the document through diagram relationships. As of python-docx 2026.05.7, Document.add_smart_art(layout_name) authors the four core diagram parts directly from vendored templates for the list / cycle / process layout families; the optional Microsoft-extension drawing1.xml (pre-rendered fallback) is omitted because Word regenerates it on open from the data + layout URN. This fixture is now authored from scratch via that API — no byte-copy from a Word-authored companion is required."
  },
  "fixtures": {
    "machine": "docx/basic-list-smartart"
  },
  "generator": {
    "python": "scripts/gen_basic_list_smartart.py"
  },
  "assertions": [
    {
      "id": "diagram-data-part-present",
      "part": "word/diagrams/data1.xml",
      "namespaces": {
        "dgm": "http://schemas.openxmlformats.org/drawingml/2006/diagram"
      },
      "xpath": "/dgm:dataModel",
      "must": "exist",
      "description": "The package must contain a `word/diagrams/data1.xml` part whose root element is <dgm:dataModel>. This part holds the SmartArt's logical shape and is the anchor the reader uses to detect that a SmartArt diagram is present."
    },
    {
      "id": "diagram-data-relationship-present",
      "part": "word/_rels/document.xml.rels",
      "namespaces": {
        "rel": "http://schemas.openxmlformats.org/package/2006/relationships"
      },
      "xpath": "//rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData']",
      "must": "exist",
      "description": "The document's relationships part must carry at least one relationship of type `diagramData`, binding the body's drawing to its data1.xml."
    }
  ]
}

Fixture

Download basic-list-smartart.docx (22.6 KB)

Reference preview

No rendered reference is available for this case.

Spec notes

SmartArt is not a single element — it is a five-part authoring surface (data / layout / colors / quickStyle / drawing) bound to the document through diagram relationships. As of python-docx 2026.05.7, Document.add_smart_art(layout_name) authors the four core diagram parts directly from vendored templates for the list / cycle / process layout families; the optional Microsoft-extension drawing1.xml (pre-rendered fallback) is omitted because Word regenerates it on open from the data + layout URN. This fixture is now authored from scratch via that API — no byte-copy from a Word-authored companion is required.