Python PPTX Presentation
Create editable .pptx decks with python-pptx as the primary route. Use write_pptx only as the no-Python fallback described below.
Source And Outline Gate
- Confirm topic, audience, target slide count, output path, and source files.
- Read
assets/brand.md and assets/deck-structure.md; do not hardcode brand values in this file.
- Read all source materials before summarizing. 多份素材要分别记录来源;for multiple sources, record each source separately and cite the source or basis for every planned slide.
- If
read_pdf or read_docx returns ⟦SCANNED_PDF⟧, stop and ask whether to use ocr_document. Explain that OCR sends page images to the configured vision service and may involve 数据出境. Do not call OCR until the user agrees.
- Treat
ocr_document output marked ⟦视觉识别·非逐字引用级⟧ as non-verbatim recognition. Flag dates, amounts, parties, negative terms, article numbers, and other key facts for manual source checking.
- 先产出文字大纲,不要直接生成 PPT. Each slide outline must include layout, title, key points, notes, and source basis.
- 必须等用户确认或调整后再生成
.pptx.
Primary Python Route
- Use the SDK built-in
Write tool for Python source files and the SDK built-in Bash tool for execution.
- Install packages only in the app-managed isolated Python runtime. Before install/run, verify:
python -c "import os, sys; print(sys.executable); print(sys.prefix); print(os.environ.get('VIRTUAL_ENV')); print(os.environ.get('PIP_REQUIRE_VIRTUALENV'))"
VIRTUAL_ENV must be non-empty, PIP_REQUIRE_VIRTUALENV must be true, and python must point inside the isolated runtime.
- Install required packages with exactly:
python -m pip install python-pptx Pillow
- Do not use
pip, pip3, sudo, brew, apt, or system Python package locations.
- For Dentons/Dacheng decks, read
references/dentons-style.md and adapt references/dentons_deck_template.py instead of inventing coordinates from scratch.
- Use native PowerPoint objects: text boxes, shapes, tables, lines, fills, and notes. Do not render whole slides or tables as screenshots.
PPTX Operations And QA
Use references/pptx-ops.md for mechanical operations:
markitdown extraction for existing .pptx files.
- package validation with the migrated
scripts/office/* utilities.
- optional rendering helpers only when the user explicitly asks for deeper visual checking.
无 Python Fallback
Use this only when the isolated runtime cannot be used: VIRTUAL_ENV is empty, PIP_REQUIRE_VIRTUALENV is not true, or python -m pip install python-pptx Pillow fails.
When this happens, call write_pptx only to generate a clearly labeled draft. The title or opening note must include:
草稿(未走 python-pptx,版式精度有限)
Tell the user that the file is a fallback draft and should be regenerated with python-pptx-presentation after Python is ready.
Validation Checklist
Default validation is a lightweight check / 默认只做轻量校验:
- Confirm the
.pptx exists, is non-zero size, and contains ppt/presentation.xml.
- Confirm brand values came from
assets/brand.md / assets/brand.json, not ad hoc constants.
- Confirm Dentons/Dacheng decks follow
references/dentons-style.md: cover, contents, content pages, ending page, fixed title/footer conventions, and no page logo or text watermark.
- Confirm slide count, title/footer structure, source basis, and absence of obvious placeholders before final reporting.
- Do not install LibreOffice, convert every slide to images, or spawn extra review tasks for default validation. If the user explicitly asks for deeper visual checking, use the optional rendering helpers in
references/pptx-ops.md.
1---2name: python-pptx-presentation3description: 制作、修改、检查或质检 PowerPoint/PPTX/deck/presentation,尤其适用于 Dentons/Dacheng/大成品牌法律汇报。4metadata:5 source: https://skillmd.com/skills/cslawyer1985/python-pptx-presentation6 displayName: 制作 PPT7 group: pptx8---910# Python PPTX Presentation1112Create editable `.pptx` decks with `python-pptx` as the primary route. Use `write_pptx` only as the no-Python fallback described below.1314## Source And Outline Gate15161. Confirm topic, audience, target slide count, output path, and source files.172. Read `assets/brand.md` and `assets/deck-structure.md`; do not hardcode brand values in this file.183. Read all source materials before summarizing. 多份素材要分别记录来源;for multiple sources, record each source separately and cite the source or basis for every planned slide.194. If `read_pdf` or `read_docx` returns `⟦SCANNED_PDF⟧`, stop and ask whether to use `ocr_document`. Explain that OCR sends page images to the configured vision service and may involve 数据出境. Do not call OCR until the user agrees.205. Treat `ocr_document` output marked `⟦视觉识别·非逐字引用级⟧` as non-verbatim recognition. Flag dates, amounts, parties, negative terms, article numbers, and other key facts for manual source checking.216. 先产出文字大纲,不要直接生成 PPT. Each slide outline must include layout, title, key points, notes, and source basis.227. 必须等用户确认或调整后再生成 `.pptx`.2324## Primary Python Route2526- Use the SDK built-in `Write` tool for Python source files and the SDK built-in `Bash` tool for execution.27- Install packages only in the app-managed isolated Python runtime. Before install/run, verify:2829```bash30python -c "import os, sys; print(sys.executable); print(sys.prefix); print(os.environ.get('VIRTUAL_ENV')); print(os.environ.get('PIP_REQUIRE_VIRTUALENV'))"31```3233- `VIRTUAL_ENV` must be non-empty, `PIP_REQUIRE_VIRTUALENV` must be `true`, and `python` must point inside the isolated runtime.34- Install required packages with exactly:3536```bash37python -m pip install python-pptx Pillow38```3940- Do not use `pip`, `pip3`, `sudo`, `brew`, `apt`, or system Python package locations.41- For Dentons/Dacheng decks, read `references/dentons-style.md` and adapt `references/dentons_deck_template.py` instead of inventing coordinates from scratch.42- Use native PowerPoint objects: text boxes, shapes, tables, lines, fills, and notes. Do not render whole slides or tables as screenshots.4344## PPTX Operations And QA4546Use `references/pptx-ops.md` for mechanical operations:4748- `markitdown` extraction for existing `.pptx` files.49- package validation with the migrated `scripts/office/*` utilities.50- optional rendering helpers only when the user explicitly asks for deeper visual checking.5152## 无 Python Fallback5354Use this only when the isolated runtime cannot be used: `VIRTUAL_ENV` is empty, `PIP_REQUIRE_VIRTUALENV` is not `true`, or `python -m pip install python-pptx Pillow` fails.5556When this happens, call `write_pptx` only to generate a clearly labeled draft. The title or opening note must include:5758`草稿(未走 python-pptx,版式精度有限)`5960Tell the user that the file is a fallback draft and should be regenerated with `python-pptx-presentation` after Python is ready.6162## Validation Checklist6364Default validation is a lightweight check / 默认只做轻量校验:6566- Confirm the `.pptx` exists, is non-zero size, and contains `ppt/presentation.xml`.67- Confirm brand values came from `assets/brand.md` / `assets/brand.json`, not ad hoc constants.68- Confirm Dentons/Dacheng decks follow `references/dentons-style.md`: cover, contents, content pages, ending page, fixed title/footer conventions, and no page logo or text watermark.69- Confirm slide count, title/footer structure, source basis, and absence of obvious placeholders before final reporting.70- Do not install LibreOffice, convert every slide to images, or spawn extra review tasks for default validation. If the user explicitly asks for deeper visual checking, use the optional rendering helpers in `references/pptx-ops.md`.