The ``docProps/custom.xml`` part stores user-defined name/value pairs with a typed child from the ``vt:`` namespace. This family covers one case per type python-pptx can emit: lpwstr, bool, i4, r8, filetime, and (as of the Wave 8 W8-E fix) date.
Library verdicts: python-pptx: — pptxjs: —
| Feature id | pptx/custom-properties-types--bool |
|---|---|
| Format | pptx |
| Category | metadata |
| Family | pptx/custom-properties-types |
| Axis values | type=bool |
| Spec | ecma-376-5-part-2 § 11.2 |
| ID / part | Predicate | XPath | python-pptx | pptxjs |
|---|---|---|---|---|
custom-bool-presentdocProps/custom.xml | existTestProp must carry a <vt:bool> child. | //op:property[@name='TestProp']/vt:bool | — | — |
custom-bool-valuedocProps/custom.xml | equal = trueTestProp's <vt:bool> must carry the expected literal text. | //op:property[@name='TestProp']/vt:bool | — | — |
No render assertions declared.
scripts/gen_custom_properties_types_pptx.py
#!/usr/bin/env python3
"""Generate ``fixtures/pptx/custom-properties-types--<type>.pptx`` fixtures.
Parameterised generator; drives ``features/pptx/custom-properties-types.json``.
"""
from __future__ import annotations
import argparse
import datetime as _dt
from pathlib import Path
from pptx import Presentation
_REPO_ROOT = Path(__file__).resolve().parent.parent
_REPRODUCIBLE_DT = _dt.datetime(2000, 1, 1, 0, 0, 0)
_PINNED_CREATED = _dt.datetime(2026, 1, 1, 0, 0, 0, tzinfo=_dt.timezone.utc)
_PINNED_MODIFIED = _dt.datetime(2026, 1, 2, 0, 0, 0, tzinfo=_dt.timezone.utc)
def _coerce(vt_id: str, value: str):
if vt_id == "lpwstr":
return value
if vt_id == "bool":
return value.lower() == "true"
if vt_id == "i4":
return int(value)
if vt_id == "r8":
return float(value)
if vt_id == "filetime":
return _dt.datetime.strptime(value, "%Y-%m-%dT%H:%M:%S")
if vt_id == "date":
return _dt.datetime.strptime(value, "%Y-%m-%d").date()
raise SystemExit(f"Unknown vt type id: {vt_id!r}")
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--type", dest="type_id", required=True)
parser.add_argument("--value", required=True)
parser.add_argument(
"--out",
default=str(_REPO_ROOT / "fixtures" / "pptx" / "custom-properties-types.pptx"),
)
args = parser.parse_args()
out_path = Path(args.out)
if not out_path.is_absolute():
out_path = _REPO_ROOT / out_path
prs = Presentation()
prs.slides.add_slide(prs.slide_layouts[6])
prs.core_properties.created = _PINNED_CREATED
prs.core_properties.modified = _PINNED_MODIFIED
prs.custom_properties["TestProp"] = _coerce(args.type_id, args.value)
out_path.parent.mkdir(parents=True, exist_ok=True)
prs.save(out_path, zip_date_time=_REPRODUCIBLE_DT)
print(out_path)
return 0
if __name__ == "__main__":
raise SystemExit(main())
{
"$schema": "../manifest.schema.json",
"id": "pptx/custom-properties-types--bool",
"kind": "literal",
"title": "Custom document properties: one case per vt: type",
"format": "pptx",
"category": "metadata",
"summary": "The ``docProps/custom.xml`` part stores user-defined name/value pairs with a typed child from the ``vt:`` namespace. This family covers one case per type python-pptx can emit: lpwstr, bool, i4, r8, filetime, and (as of the Wave 8 W8-E fix) date.",
"spec": {
"source": "ecma-376-5-part-2",
"clause": "11.2",
"notes": "python-pptx's CustomProperties dict facade supports str (vt:lpwstr), int (vt:i4), float (vt:r8), bool (vt:bool), datetime.datetime (vt:filetime), and — as of Wave 8 W8-E — datetime.date (vt:date, ECMA-376 Part 1 §22.4.2.7)."
},
"fixtures": {
"machine": "pptx/custom-properties-types--bool"
},
"generator": {
"python": "scripts/gen_custom_properties_types_pptx.py",
"arg_template": "--type {type.id} --value \"{type.value}\" --out fixtures/pptx/custom-properties-types--{type.id}.pptx"
},
"_expansion": {
"parent_id": "pptx/custom-properties-types",
"bindings": {
"type": "bool"
}
},
"assertions": [
{
"id": "custom-bool-present",
"part": "docProps/custom.xml",
"namespaces": {
"op": "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",
"vt": "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"
},
"xpath": "//op:property[@name='TestProp']/vt:bool",
"must": "exist",
"description": "TestProp must carry a <vt:bool> child."
},
{
"id": "custom-bool-value",
"part": "docProps/custom.xml",
"namespaces": {
"op": "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",
"vt": "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"
},
"xpath": "//op:property[@name='TestProp']/vt:bool",
"must": "equal",
"value": "true",
"description": "TestProp's <vt:bool> must carry the expected literal text."
}
]
}
No rendered reference is available for this case.