ppt-editing-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Editing Presentations

编辑演示文稿

Template-Based Workflow

基于模板的工作流

When using an existing presentation as a template:
  1. Copy and analyze:
    bash
    cp /path/to/user-provided.pptx template.pptx
    python -m markitdown template.pptx > template.md
    Review
    template.md
    to see placeholder text and slide structure.
  2. Plan slide mapping: For each content section, choose a template slide.
    ⚠️ USE VARIED LAYOUTS — monotonous presentations are a common failure mode. Don't default to basic title + bullet slides. Actively seek out:
    • Multi-column layouts (2-column, 3-column)
    • Image + text combinations
    • Full-bleed images with text overlay
    • Quote or callout slides
    • Section dividers
    • Stat/number callouts
    • Icon grids or icon + text rows
    Avoid: Repeating the same text-heavy layout for every slide.
    Match content type to layout style (e.g., key points → bullet slide, team info → multi-column, testimonials → quote slide).
  3. Unpack
  4. Build presentation (do this yourself, not with subagents):
    • Delete unwanted slides (remove from
      <p:sldIdLst>
      )
    • Duplicate slides you want to reuse (
      add_slide.py
      )
    • Reorder slides in
      <p:sldIdLst>
    • Complete all structural changes before step 5
  5. Edit content: Update text in each
    slide{N}.xml
    . Use subagents here if available — slides are separate XML files, so subagents can edit in parallel.
  6. Clean
  7. Pack
当使用现有演示文稿作为模板时:
  1. 复制与分析
    bash
    cp /path/to/user-provided.pptx template.pptx
    python -m markitdown template.pptx > template.md
    查看
    template.md
    了解占位符文本和幻灯片结构。
  2. 规划幻灯片映射:为每个内容板块选择对应的模板幻灯片。
    ⚠️ 请使用多样化的版式 —— 单调的演示文稿是常见的失败场景。不要默认使用基础的标题+项目符号幻灯片,主动选择以下版式:
    • 多栏版式(2栏、3栏)
    • 图文组合版式
    • 全 bleed 图片叠加文本版式
    • 引语或标注幻灯片
    • 章节分隔页
    • 数据/数字标注页
    • 图标网格或图标+文本行版式
    避免:每张幻灯片都重复使用同样的重文本版式。
    将内容类型与版式风格匹配(例如:核心要点→项目符号幻灯片,团队信息→多栏版式,用户评价→引语幻灯片)。
  3. 解压
  4. 构建演示文稿(请自行完成,不要使用子Agent):
    • 删除不需要的幻灯片(从
      <p:sldIdLst>
      中移除)
    • 复制你想要复用的幻灯片(使用
      add_slide.py
    • <p:sldIdLst>
      中重排幻灯片顺序
    • 在步骤5前完成所有结构变更
  5. 编辑内容:更新每个
    slide{N}.xml
    中的文本。 如果有可用的子Agent可以在此处使用——幻灯片是独立的XML文件,因此子Agent可以并行编辑。
  6. 清理
  7. 打包

Output Structure

输出结构

Copy the user-provided file to
template.pptx
in cwd. This preserves the original and gives a predictable name for all downstream scripts.
bash
cp /path/to/user-provided.pptx template.pptx
text
./
├── template.pptx               # Copy of user-provided file (never modified)
├── template.md                 # markitdown extraction
├── unpacked/                   # Editable XML tree
└── edited.pptx                 # Final repacked deck
Minimum expected deliverable:
edited.pptx
.

将用户提供的文件复制到当前工作目录下的
template.pptx
,这样可以保留原始文件,同时为所有下游脚本提供固定的文件名。
bash
cp /path/to/user-provided.pptx template.pptx
text
./
├── template.pptx               # 用户提供文件的副本(永不修改)
├── template.md                 # markitdown提取的内容
├── unpacked/                   # 可编辑的XML目录树
└── edited.pptx                 # 最终重新打包的演示文稿
最低预期交付物:
edited.pptx

Scripts

脚本说明

ScriptPurpose
unpack.py
Extract and pretty-print PPTX
add_slide.py
Duplicate slide or create from layout
clean.py
Remove orphaned files
pack.py
Repack with validation
Removes slides not in
<p:sldIdLst>
, unreferenced media, orphaned rels.
Always write to
/tmp/
first, then copy to the final path. Python's
zipfile
module uses
seek
internally, which fails on some volume mounts (e.g. Docker bind mounts). Writing to a local temp path avoids this.
Validates, repairs, condenses XML, re-encodes smart quotes.

脚本用途
unpack.py
解压并格式化PPTX文件
add_slide.py
复制幻灯片或从版式创建新幻灯片
clean.py
移除孤立文件
pack.py
带验证的重新打包
会移除不在
<p:sldIdLst>
中的幻灯片、未被引用的媒体文件、孤立的关联关系。
请始终先写入
/tmp/
目录,再复制到最终路径。Python的
zipfile
模块内部使用
seek
操作,在某些挂载卷(例如Docker绑定挂载)上会失败,写入本地临时路径可以避免该问题。
会执行验证、修复、压缩XML、重新编码智能引号等操作。

Slide Operations

幻灯片操作

Slide order is in
ppt/presentation.xml
<p:sldIdLst>
.
Reorder: Rearrange
<p:sldId>
elements.
Delete: Remove
<p:sldId>
, then run
clean.py
.
Add: Use
add_slide.py
. Never manually copy slide files—the script handles notes references, Content_Types.xml, and relationship IDs that manual copying misses.

幻灯片顺序存储在
ppt/presentation.xml
<p:sldIdLst>
节点中。
重排:重新排列
<p:sldId>
元素的顺序。
删除:移除
<p:sldId>
元素,然后运行
clean.py
新增:使用
add_slide.py
。永远不要手动复制幻灯片文件——脚本会处理备注引用、Content_Types.xml和关联ID,这些是手动复制容易遗漏的。

Editing Content

内容编辑

Subagents: If available, use them here (after completing step 4). Each slide is a separate XML file, so subagents can edit in parallel. In your prompt to subagents, include:
  • The slide file path(s) to edit
  • "Use the Edit tool for all changes"
  • The formatting rules and common pitfalls below
For each slide:
  1. Read the slide's XML
  2. Identify ALL placeholder content—text, images, charts, icons, captions
  3. Replace each placeholder with final content
Use the Edit tool, not sed or Python scripts. The Edit tool forces specificity about what to replace and where, yielding better reliability.
子Agent:如果有可用的子Agent,可以在此步骤(完成步骤4后)使用。每张幻灯片都是独立的XML文件,因此子Agent可以并行编辑。在给子Agent的提示词中,请包含:
  • 需要编辑的幻灯片文件路径
  • "所有变更都使用Edit工具完成"
  • 下方的格式规则和常见陷阱
对每张幻灯片:
  1. 读取幻灯片的XML内容
  2. 识别所有占位符内容——文本、图片、图表、图标、标题
  3. 将每个占位符替换为最终内容
使用Edit工具,不要使用sed或Python脚本。Edit工具会强制明确要替换的内容和位置,可靠性更高。

Formatting Rules

格式规则

  • Bold all headers, subheadings, and inline labels: Use
    b="1"
    on
    <a:rPr>
    . This includes:
    • Slide titles
    • Section headers within a slide
    • Inline labels like (e.g.: "Status:", "Description:") at the start of a line
  • Never use unicode bullets (•): Use proper list formatting with
    <a:buChar>
    or
    <a:buAutoNum>
  • Bullet consistency: Let bullets inherit from the layout. Only specify
    <a:buChar>
    or
    <a:buNone>
    .

  • 所有标题、副标题和行内标签都加粗:在
    <a:rPr>
    上设置
    b="1"
    ,包括:
    • 幻灯片标题
    • 幻灯片内的章节标题
    • 行首的行内标签(例如:"状态:"、"描述:")
  • 永远不要使用Unicode项目符号(•):使用
    <a:buChar>
    <a:buAutoNum>
    实现规范的列表格式
  • 项目符号一致性:让项目符号继承版式的设置,仅指定
    <a:buChar>
    <a:buNone>
    即可。

Common Pitfalls

常见陷阱

Template Adaptation

模板适配

When source content has fewer items than the template:
  • Remove excess elements entirely (images, shapes, text boxes), don't just clear text
  • Check for orphaned visuals after clearing text content
  • Run content QA with
    markitdown
    to catch mismatched counts
When replacing text with different length content:
  • Shorter replacements: Usually safe
  • Longer replacements: May overflow or wrap unexpectedly
  • Verify with
    markitdown
    after text changes
  • Consider truncating or splitting content to fit the template's design constraints
Template slots ≠ Source items: If template has 4 team members but source has 3 users, delete the 4th member's entire group (image + text boxes), not just the text.
当源内容的条目数量少于模板时:
  • 完全移除多余的元素(图片、形状、文本框),不要仅清空文本
  • 清空文本内容后检查是否有孤立的视觉元素
  • 使用
    markitdown
    运行内容QA,捕捉数量不匹配的问题
当替换的内容长度与原占位符不同时:
  • 更短的替换内容:通常安全
  • 更长的替换内容:可能出现溢出或意外换行
  • 文本变更后用
    markitdown
    验证
  • 考虑截断或拆分内容,以适配模板的设计约束
模板槽位≠源条目:如果模板有4个团队成员位置,但源内容只有3个用户,请删除第4个成员的整个组(图片+文本框),而不仅仅是文本。

Multi-Item Content

多条目内容

If source has multiple items (numbered lists, multiple sections), create separate
<a:p>
elements for each — never concatenate into one string.
❌ WRONG — all items in one paragraph:
xml
<a:p>
  <a:r><a:rPr .../><a:t>Step 1: Do the first thing. Step 2: Do the second thing.</a:t></a:r>
</a:p>
✅ CORRECT — separate paragraphs with bold headers:
xml
<a:p>
  <a:pPr algn="l"><a:lnSpc><a:spcPts val="3919"/></a:lnSpc></a:pPr>
  <a:r><a:rPr lang="en-US" sz="2799" b="1" .../><a:t>Step 1</a:t></a:r>
</a:p>
<a:p>
  <a:pPr algn="l"><a:lnSpc><a:spcPts val="3919"/></a:lnSpc></a:pPr>
  <a:r><a:rPr lang="en-US" sz="2799" .../><a:t>Do the first thing.</a:t></a:r>
</a:p>
<a:p>
  <a:pPr algn="l"><a:lnSpc><a:spcPts val="3919"/></a:lnSpc></a:pPr>
  <a:r><a:rPr lang="en-US" sz="2799" b="1" .../><a:t>Step 2</a:t></a:r>
</a:p>
<!-- continue pattern -->
Copy
<a:pPr>
from the original paragraph to preserve line spacing. Use
b="1"
on headers.
如果源内容有多个条目(有序列表、多个章节),为每个条目创建独立的
<a:p>
元素——永远不要拼接成一个字符串
❌ 错误——所有条目放在一个段落中:
xml
<a:p>
  <a:r><a:rPr .../><a:t>Step 1: Do the first thing. Step 2: Do the second thing.</a:t></a:r>
</a:p>
✅ 正确——独立段落搭配加粗标题:
xml
<a:p>
  <a:pPr algn="l"><a:lnSpc><a:spcPts val="3919"/></a:lnSpc></a:pPr>
  <a:r><a:rPr lang="en-US" sz="2799" b="1" .../><a:t>Step 1</a:t></a:r>
</a:p>
<a:p>
  <a:pPr algn="l"><a:lnSpc><a:spcPts val="3919"/></a:lnSpc></a:pPr>
  <a:r><a:rPr lang="en-US" sz="2799" .../><a:t>Do the first thing.</a:t></a:r>
</a:p>
<a:p>
  <a:pPr algn="l"><a:lnSpc><a:spcPts val="3919"/></a:lnSpc></a:pPr>
  <a:r><a:rPr lang="en-US" sz="2799" b="1" .../><a:t>Step 2</a:t></a:r>
</a:p>
<!-- 延续该模式 -->
从原始段落复制
<a:pPr>
以保留行间距,标题使用
b="1"
加粗。

Smart Quotes

智能引号

Handled automatically by unpack/pack. But the Edit tool converts smart quotes to ASCII.
When adding new text with quotes, use XML entities:
xml
<a:t>the &#x201C;Agreement&#x201D;</a:t>
CharacterNameUnicodeXML Entity
"
Left double quoteU+201C
&#x201C;
"
Right double quoteU+201D
&#x201D;
'
Left single quoteU+2018
&#x2018;
'
Right single quoteU+2019
&#x2019;
解压/打包过程会自动处理智能引号,但Edit工具会将智能引号转换为ASCII字符。
新增带引号的文本时,请使用XML实体:
xml
<a:t>the &#x201C;Agreement&#x201D;</a:t>
字符名称UnicodeXML实体
"
左双引号U+201C
&#x201C;
"
右双引号U+201D
&#x201D;
'
左单引号U+2018
&#x2018;
'
右单引号U+2019
&#x2019;

Other

其他

  • Whitespace: Use
    xml:space="preserve"
    on
    <a:t>
    with leading/trailing spaces
  • XML parsing: Use
    defusedxml.minidom
    , not
    xml.etree.ElementTree
    (corrupts namespaces)
  • 空白字符:带有首尾空格的
    <a:t>
    标签请设置
    xml:space="preserve"
  • XML解析:使用
    defusedxml.minidom
    ,不要使用
    xml.etree.ElementTree
    (会损坏命名空间)