pptgen-drawio
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePPT 多页 Draw.io 生成(论文答辩 + 通用汇报)
Multi-page Draw.io PPT Generator (Thesis Defense + General Presentation)
本 skill 支持两种模式,共用 、、 目录,以及 Step 0 自定义模板、Step 1 确定内容与风格、Step 3 & 4 输出与导出 全流程。
ppt_template/scripts/reference/This skill supports two modes, sharing , , directories, and the full process including Step 0 Custom Template, Step 1 Confirm Content and Style, Step 3 & 4 Output and Export.
ppt_template/scripts/reference/模式识别
Mode Recognition
| 模式 | 使用时机 | 内容来源 | 默认页序 | 输出文件 |
|---|---|---|---|---|
| 论文答辩 | 学位论文答辩、开题、预答辩 | paper-write 结构化提取 | 封面→目录→背景→现状→方法→创新点→实验→结论→致谢→Q&A | |
| 通用汇报 | 工作汇报、产品介绍、演讲 | 用户消息提取/生成 | 封面→目录→节标题→内容页→总结→致谢→Q&A | |
| Mode | Use Case | Content Source | Default Page Order | Output File |
|---|---|---|---|---|
| Thesis Defense | Degree thesis defense, proposal defense, pre-defense | Structured extraction from paper-write | Cover → Table of Contents → Background → Current Status → Method → Innovation Points → Experiment → Conclusion → Acknowledgement → Q&A | |
| General Presentation | Work report, product introduction, speech | Extracted/generated from user messages | Cover → Table of Contents → Section Title → Content Pages → Summary → Acknowledgement → Q&A | |
Step 0:用户自定义模板(可选,两种模式共用)
Step 0: User Custom Template (Optional, shared by both modes)
若用户提供了自己的 模板文件:
.pptx- 模板放置:将 放入
.pptx目录ppt_template/ - 运行样式提取:在 skill 根目录下执行:
python scripts/analyze_pptx.py ppt_template/xxx.pptx reference/style-custom.md - 读取 作为「自定义风格」继续
reference/style-custom.md
目录约定: 存放模板、 样式提取、 风格文件
ppt_template/scripts/analyze_pptx.pyreference/If the user provides their own template file:
.pptx- Template Placement: Put the file into the
.pptxdirectoryppt_template/ - Run Style Extraction: Execute the following command under the skill root directory:
python scripts/analyze_pptx.py ppt_template/xxx.pptx reference/style-custom.md - Read as the "custom style" to proceed
reference/style-custom.md
Directory Convention: stores templates, is for style extraction, stores style files
ppt_template/scripts/analyze_pptx.pyreference/Step 1:确定内容与风格(两种模式共用)
Step 1: Confirm Content and Style (Shared by both modes)
1.1 确定内容
1.1 Confirm Content
- 论文答辩:若用户只有论文全文:先调用 paper-write 的「结构化信息提取」;若已提供结构化信息:从消息中提取【论文题目】【学科方向】【答辩时长】【论文结构/目录】【各章核心内容】【创新点/贡献】等,缺失则追问
- 通用汇报:从用户消息中提取幻灯片大纲及内容,或根据核心需求扩展为完整结构
- Thesis Defense: If the user only has the full paper: first call the "structured information extraction" of paper-write; if structured information is already provided: extract [Paper Title], [Discipline Direction], [Defense Duration], [Paper Structure/Table of Contents], [Core Content of Each Chapter], [Innovation Points/Contributions], etc. from the message, ask for missing information if any
- General Presentation: Extract slide outline and content from user messages, or expand to complete structure based on core requirements
1.2 选择风格
1.2 Select Style
两种模式均可选择以下风格之一,读取对应 reference 文件获取配色、字体、版式规则与 XML 样式片段:
| # | 风格 | 主色 | 强调色 | reference 文件 |
|---|---|---|---|---|
| 1 | 经典学术 / 商务严谨 | | | |
| 2 | 现代极简 / 大字报感 | | | |
| 3 | 暖色学术 / 亲和力 | | | |
| 4 | 科技明快 / 现代前沿 | | 同主色 | |
| 5 | 自定义 | 从 style-custom.md 提取 | |
- 论文答辩:用户未指定时默认风格 1
- 通用汇报:用户选择或根据语境自动推荐
Both modes can choose one of the following styles, read the corresponding reference file to obtain color matching, font, layout rules and XML style fragments:
| # | Style | Main Color | Accent Color | Reference File |
|---|---|---|---|---|
| 1 | Classic Academic / Business Rigorous | | | |
| 2 | Modern Minimalist / Big Poster Style | | | |
| 3 | Warm Academic / High Affinity | | | |
| 4 | Bright Tech / Modern Cutting-edge | | Same as main color | |
| 5 | Custom | Extracted from style-custom.md | |
- Thesis Defense: Default to style 1 if not specified by the user
- General Presentation: Selected by the user or automatically recommended according to the context
Step 2:生成多页 Draw.io XML
Step 2: Generate Multi-page Draw.io XML
必须先读取所选风格的 reference 文件,基于该风格生成 XML。
- 画布:16:9(pageWidth=1920,pageHeight=1080)
- 页序:按模式识别表中的默认页序
- 页数:10 分钟约 10–12 页,15 分钟约 14–18 页
- 含节标题过渡页(每章独立一页引入)时,10 分钟约 11 页;无过渡页时约 9 页
- 节标题过渡页风格:大号数字 + 章节名,可参考 style2 风格或 style4(无过渡页)
You must first read the reference file of the selected style, and generate XML based on this style.
- Canvas: 16:9 (pageWidth=1920, pageHeight=1080)
- Page order: Follow the default page order in the mode recognition table
- Number of pages: About 10–12 pages for 10 minutes, about 14–18 pages for 15 minutes
- With section title transition pages (one separate introduction page per chapter), about 11 pages for 10 minutes; about 9 pages without transition pages
- Section title transition page style: large number + chapter name, refer to style 2 or style 4 (no transition pages)
2.1 论文答辩模式默认页序(23 页,四种风格共享)
2.1 Default Page Order for Thesis Defense Mode (23 pages, shared by four styles)
当用户选择论文答辩模式、且未另行指定页数时,所有风格(style1–4)默认采用统一的 23 页结构:
- 封面
- 目录
- 01 研究背景与意义(节标题)
4–6. 01. 研究背景与意义(内容 3 页) - 02 国内外研究现状(节标题)
8–9. 02. 国内外研究现状(内容 2 页) - 03 方法总览(节标题)
11–13. 03. 方法总览(内容 3 页) - 04 实验结果(节标题)
15–16. 04. 实验结果(内容 2 页) - 05 系统设计(节标题)
18–19. 05. 系统设计与实现(内容 2 页) - 06 总结与展望(节标题)
-
- 总结与展望(内容 1 页)
- 已有成果
- 致谢 / Q & A
各 reference/styleX-*.md 只定义样式与版式(颜色、字体、组件布局),不再重复定义页序;如需修改默认页序,应在本 SKILL 中统一调整。
When the user selects the thesis defense mode and does not specify the number of pages separately, all styles (style1–4) adopt a unified 23-page structure by default:
- Cover
- Table of Contents
- 01 Research Background and Significance (Section Title)
4–6. 01. Research Background and Significance (3 content pages) - 02 Domestic and Foreign Research Status (Section Title)
8–9. 02. Domestic and Foreign Research Status (2 content pages) - 03 Method Overview (Section Title)
11–13. 03. Method Overview (3 content pages) - 04 Experimental Results (Section Title)
15–16. 04. Experimental Results (2 content pages) - 05 System Design (Section Title)
18–19. 05. System Design and Implementation (2 content pages) - 06 Summary and Outlook (Section Title)
-
- Summary and Outlook (1 content page)
- Existing Achievements
- Acknowledgement / Q & A
Each reference/styleX-*.md only defines style and layout (color, font, component layout), and no longer defines the page order repeatedly; if you need to modify the default page order, you should adjust it uniformly in this SKILL.
2.2 文件命名与交付(建议,Windows 兼容)
2.2 File Naming and Delivery (Recommended, Windows compatible)
- 推荐命名(生成/导出阶段):优先使用 ASCII 文件名(英文字母/数字/中划线),减少 PowerShell/编码环境下中文文件名乱码、命令找不到文件等问题。
- 推荐:、
defense-style4-tech.drawiodefense-style4-tech.pptx - 如必须中文名:建议先用 ASCII 名完成导出,再在资源管理器里重命名为中文
- 推荐:
- 交付顺序(推荐流程):先提供 (源文件)→ 执行命令导出
.drawio(交付文件)→ 校验页数.pptx - 交付依赖:接收方只需打开 (必要时附
.pptx),不需要安装 Python;脚本/代码仅用于生成端自动写 XML(可选)。.drawio
- Recommended Naming (Generation/Export Stage): Prioritize ASCII file names (English letters/numbers/hyphens) to reduce problems such as garbled Chinese file names and files not found by commands in PowerShell/encoding environments.
- Recommended: ,
defense-style4-tech.drawiodefense-style4-tech.pptx - If Chinese name is required: it is recommended to complete the export with ASCII name first, and then rename it to Chinese in the file explorer
- Recommended:
- Delivery Order (Recommended Process): Provide (source file) first → Execute command to export
.drawio(delivery file) → Verify the number of pages.pptx - Delivery Dependency: The receiver only needs to open (attach
.pptxif necessary), no need to install Python; scripts/code are only used for automatic XML writing on the generation side (optional)..drawio
⚠️ 已知坑清单(生成前逐条过)
⚠️ List of Known Pitfalls (Check one by one before generation)
生成每一页 XML 前,按下面 checklist 快速自检(只保留高频致命项):
Before generating XML for each page, perform a quick self-check according to the checklist below (only keep high-frequency fatal items):
✅ 必过 checklist(10 条)
✅ Mandatory Checklist (10 items)
- 多页结构:根节点必须是 ,且每页一个
<mxfile>(否则导出会变 1 页)。<diagram> - 每页坐标系:每个 内
<diagram>从 0 开始;背景矩形x;每页都有x=0,y=0,w=1920,h=1080与mxCell id="0"。mxCell id="1" parent="0" - ID 唯一:全文件内所有 必须唯一;每个
mxCell id也必须唯一。<diagram id="..."> - 一次性写入:必须一次写完整(不要多次覆盖/拼接 XML)。
.drawio - 页数校验:输出的
drawio2pptx必须等于(N slides)数量。<diagram> - 每页 cell 数量:封面 ≥ 12、节标题 ≥ 8、内容页 ≥ 15(避免“空页”)。
- 换行只用真实换行:在生成 XML 时,正文多行必须写成真实换行符(代码里用 拼接,再一次性写入文件),禁止在
\n中写value="..."/
/<br>,也禁止通过 Shell 将<font>/<b>替换成字面量&#xa;;文本 style 必含`n。whiteSpace=wrap;html=1; - 白字不要误替换:顶栏/深色块文字保持 ;背景色替换优先改
fontColor=#FFFFFF,不要全局替换所有fillColor。#FFFFFF - 遮挡检查:带底色的装饰块不要跨越正文区域;两列卡片之间不要放有底色标签(会压住字)。
- 高度预算:多行正文的卡片/容器宁可偏高留白,避免裁字(正文行高约 (1.4\times) 字号)。
- Multi-page Structure: The root node must be , and each page has one
<mxfile>(otherwise it will be exported as 1 page).<diagram> - Coordinate System per Page: starts from 0 in each
x; background rectangle<diagram>; each page hasx=0,y=0,w=1920,h=1080andmxCell id="0".mxCell id="1" parent="0" - Unique ID: All in the entire file must be unique; each
mxCell idmust also be unique.<diagram id="..."> - One-time Writing: must be written completely at one time (do not overwrite/splice XML multiple times).
.drawio - Page Count Verification: The output by
(N slides)must be equal to the number ofdrawio2pptx.<diagram> - Cell Count per Page: Cover ≥ 12, section title ≥ 8, content page ≥ 15 (avoid "blank pages").
- Only use real line breaks for line wrapping: When generating XML, multi-line body text must be written as real line breaks (use to splice in the code, and then write to the file at one time). It is forbidden to write
\n/
/<br>in<font>/<b>, and it is also forbidden to replacevalue="..."with literal&#xa;through Shell; text style must include`n.whiteSpace=wrap;html=1; - Do not replace white text by mistake: The text in the top bar/dark block keeps ; when replacing the background color, prioritize modifying
fontColor=#FFFFFF, do not replace allfillColorglobally.#FFFFFF - Occlusion Check: Decorative blocks with background color should not cross the body area; do not place labels with background color between two columns of cards (it will press the text).
- Height Budget: The card/container for multi-line body text should be rather higher to leave blank space to avoid cutting text (body line height is about (1.4\times) font size).
最小可用多页模板(仅示意结构)
Minimum Available Multi-page Template (only for structure demonstration)
xml
<mxfile host="app.diagrams.net">
<diagram id="p1" name="封面">
<mxGraphModel page="1" pageWidth="1920" pageHeight="1080">
<root>
<mxCell id="0"/><mxCell id="1" parent="0"/>
</root>
</mxGraphModel>
</diagram>
<diagram id="p2" name="目录">
<mxGraphModel page="1" pageWidth="1920" pageHeight="1080">
<root>
<mxCell id="0"/><mxCell id="1" parent="0"/>
</root>
</mxGraphModel>
</diagram>
</mxfile>xml
<mxfile host="app.diagrams.net">
<diagram id="p1" name="封面">
<mxGraphModel page="1" pageWidth="1920" pageHeight="1080">
<root>
<mxCell id="0"/><mxCell id="1" parent="0"/>
</root>
</mxGraphModel>
</diagram>
<diagram id="p2" name="目录">
<mxGraphModel page="1" pageWidth="1920" pageHeight="1080">
<root>
<mxCell id="0"/><mxCell id="1" parent="0"/>
</root>
</mxGraphModel>
</diagram>
</mxfile>Step 3 & 4:输出 Draw.io 并自动导出 PPT(两种模式共用)
Step 3 & 4: Output Draw.io and Automatically Export PPT (Shared by both modes)
Step 3:输出 Draw.io 文件
Step 3: Output Draw.io File
将生成的 XML 一次性 写入工作区 文件(论文答辩用 ,通用汇报用 ),并简述每页概要。
.drawiopaper-defense.drawiogeneral-presentation.drawio写入方式需满足 checklist 第 4 条「一次性写入」与第 7 条「换行只用真实换行」的要求。
Write the generated XML at one time into the file in the workspace (use for thesis defense, for general presentation), and briefly describe the summary of each page.
.drawiopaper-defense.drawiogeneral-presentation.drawioThe writing method must meet the requirements of Item 4 "One-time Writing" and Item 7 "Only use real line breaks for line wrapping" in the checklist.
Step 4:自动导出 PPT(必执行)
Step 4: Automatically Export PPT (Mandatory Execution)
生成 后,执行导出(推荐在生成端完成导出后再交付):
.drawio- 如未安装:
pip install drawio2pptx -q - 切换到 文件所在目录(必须先 cd/Set-Location,否则找不到文件):
.drawiopowershellSet-Location "d:\你的项目目录" drawio2pptx <文件名>.drawio <文件名>.pptx - 验证输出页数:输出中必须包含 ,且 (N) 等于
Saved xxx.pptx (N slides)数量(对应 checklist 第 5 条「页数校验」)<diagram>
页数验证需满足 checklist 第 5 条「页数校验」。
After generating , perform the export (it is recommended to complete the export on the generation side before delivery):
.drawio- If not installed:
pip install drawio2pptx -q - Switch to the directory where the file is located (you must cd/Set-Location first, otherwise the file cannot be found):
.drawiopowershellSet-Location "d:\你的项目目录" drawio2pptx <文件名>.drawio <文件名>.pptx - Verify the number of output pages: The output must contain , and (N) is equal to the number of
Saved xxx.pptx (N slides)(corresponding to Item 5 "Page Count Verification" in the checklist)<diagram>
Page count verification must meet the requirements of Item 5 "Page Count Verification" in the checklist.
导出失败排查(高频)
Export Failure Troubleshooting (High Frequency)
- Permission denied / 拒绝访问:目标 正在被 PowerPoint 占用。
.pptx- 解决:导出到新文件名(如 ),或先关闭 PPT 再覆盖导出。
*-v2.pptx
- 解决:导出到新文件名(如
- 中文文件名乱码/找不到文件:终端编码导致路径解析异常。
- 解决:改用 ASCII 文件名生成与导出(见 2.2)。
- Permission denied: The target is being occupied by PowerPoint.
.pptx- Solution: Export to a new file name (such as ), or close the PPT first and then overwrite the export.
*-v2.pptx
- Solution: Export to a new file name (such as
- Garbled Chinese file name / File not found: Terminal encoding causes abnormal path resolution.
- Solution: Use ASCII file names for generation and export (see 2.2).
其他注意事项
Other Notes
- 统一字号规则(所有风格):
- 内容页中文正文(段落 + 列表要点)统一使用 18 pt;
- 内容页章节标题一般为 30 pt,节标题页大号数字/章节名继续按各 styleX 中示例执行;
- 日期、页脚、小标签、图表表头等次要信息可保持 13–16 pt 之间的现有设计。
- 字体推荐:中文标题/正文优先使用 微软雅黑 或 宋体;数字、英文及公式使用 Times New Roman。各风格 reference 可在此基础上微调(如英文标题用 Georgia)。
- XML 标签正确闭合,特殊字符转义(→
&,&→<)< - 每页布局:背景全画布矩形、标题区 44–56pt、正文按照 18pt 行高预留空间、留白充足
- Windows 下不支持 命令,Shell 输出截断请用 PowerShell 的
tail替代Select-Object -Last N
- Unified Font Size Rules (All Styles):
- Chinese body text on content pages (paragraphs + list points) uniformly use 18 pt;
- Chapter titles on content pages are generally 30 pt, large numbers/chapter names on section title pages continue to follow the examples in each styleX;
- Secondary information such as date, footer, small labels, chart headers can keep the existing design between 13–16 pt.
- Font Recommendation: Chinese titles/body text prefer Microsoft Yahei or Song Typeface; numbers, English and formulas use Times New Roman. Each style reference can be fine-tuned on this basis (such as using Georgia for English titles).
- XML tags are closed correctly, special characters are escaped (→
&,&→<)< - Page layout: Full canvas background rectangle, title area 44–56pt, body text reserved space according to 18pt line height, sufficient blank space
- command is not supported under Windows, use PowerShell's
tailinstead for Shell output truncationSelect-Object -Last N