xlsx/package-thumbnail-dropped

python-xlsx authors workbooks programmatically so the output never contains a stale preview image.

Library verdicts: python-xlsx: — xlsxjs: —

Metadata

Feature idxlsx/package-thumbnail-dropped
Formatxlsx
Categorypackaging
Spececma-376-5-part-2 § 10.1.10

XPath assertions

ID / partPredicateXPathpython-xlsxxlsxjs
thumbnail-part-absent
absent
`docProps/thumbnail.jpeg` MUST NOT appear in the output package.

Render assertions

No render assertions declared.

Generator source

scripts/gen_xlsx_package_thumbnail_dropped.py

#!/usr/bin/env python3
"""Generate ``fixtures/xlsx/package-thumbnail-dropped.xlsx``.

Sibling of ``gen_package_thumbnail_dropped.py`` (docx) but for
python-xlsx. python-xlsx builds workbooks programmatically without
a binary template, so ``docProps/thumbnail.jpeg`` is trivially
absent — this fixture proves the absence and guards against a
regression where the library might later start shipping a template
thumbnail.
"""

from __future__ import annotations

from pathlib import Path

from xlsx import Workbook

_REPO_ROOT = Path(__file__).resolve().parent.parent
_OUT = _REPO_ROOT / "fixtures" / "xlsx" / "package-thumbnail-dropped.xlsx"


def main() -> int:
    wb = Workbook()
    ws = wb.active
    ws["A1"] = "Package-thumbnail-drop check."
    _OUT.parent.mkdir(parents=True, exist_ok=True)
    wb.save(_OUT)
    print(_OUT)
    return 0


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

Manifest (expanded)

{
  "$schema": "../manifest.schema.json",
  "id": "xlsx/package-thumbnail-dropped",
  "title": "Package thumbnail dropped on save",
  "format": "xlsx",
  "category": "packaging",
  "summary": "python-xlsx authors workbooks programmatically so the output never contains a stale preview image.",
  "roles": [
    "authoring"
  ],
  "spec": {
    "source": "ecma-376-5-part-2",
    "clause": "10.1.10",
    "notes": "Unlike python-docx and python-pptx, python-xlsx does not copy parts out of a bundled .xlsx template on save — it emits every part programmatically from Workbook state. `docProps/thumbnail.jpeg` is therefore trivially absent. This manifest is a regression guard: if a future change starts shipping a bundled template thumbnail the assertion will start failing."
  },
  "fixtures": {
    "machine": "xlsx/package-thumbnail-dropped"
  },
  "generator": {
    "python": "scripts/gen_xlsx_package_thumbnail_dropped.py"
  },
  "assertions": [
    {
      "id": "thumbnail-part-absent",
      "kind": "zip_contains_path",
      "path": "docProps/thumbnail.jpeg",
      "must": "absent",
      "description": "`docProps/thumbnail.jpeg` MUST NOT appear in the output package."
    }
  ]
}

Fixture

Download package-thumbnail-dropped.xlsx (4.7 KB)

Reference preview

No rendered reference is available for this case.

Spec notes

Unlike python-docx and python-pptx, python-xlsx does not copy parts out of a bundled .xlsx template on save — it emits every part programmatically from Workbook state. `docProps/thumbnail.jpeg` is therefore trivially absent. This manifest is a regression guard: if a future change starts shipping a bundled template thumbnail the assertion will start failing.