AgentStack
SKILL verified MIT Self-run

Pptx Cn

skill-ssssliug-claude-skill-pptx-cn-claude-skill-pptx-cn · by ssssliug

生成 .pptx(pptxgenjs)——Node 实现、中文优先、研究汇报向。内置 Node 运行法 / 共享依赖 NODE_PATH 技巧、中文字体坑、navy 学术配色、结果表(Rel/Gen/Loc/Avg 最佳值标红)模板、图表脚手架、以及「仿既有 PPT 直接拷其生成器设计系统」配方。触发:做 PPT / 幻灯片 / deck / presentation / .pptx,尤其涉及中文、实验结果表、指标、中英混排,或要匹配某套既有 PPT 风格。

No reviews yet
0 installs
0 views
view→install

Install

$ agentstack add skill-ssssliug-claude-skill-pptx-cn-claude-skill-pptx-cn

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Pptx Cn? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

PPT 文档生成(Node · 中文 · 研究向)

面向 Node-only 环境(无 Python / LibreOffice / pandoc,在 Windows + Node v24 上验证过;macOS / Linux 同理)。.pptxpptxgenjs只做创建——转 PDF / 缩略图 / schema 校验等 QA 本机跑不了(要视觉预览需另装 LibreOffice)。

官方 ~/.claude/skills/pptx(默认停用,文件仍在)有更全的踩坑表与 Python 脚本(校验 / 缩略图 / 模板编辑 / tracked changes / comments)。遇到复杂或排错场景,可手动 cat ~/.claude/skills/pptx/SKILL.md 当字典查——它不自动加载,但内容在。配套 Word 技能见 docx-cn

运行(两种方式任选)

方式 A · 本仓库装依赖(推荐,跨平台):仓库根 package.json 已列好依赖,npm install 后直接跑:

npm install
node templates/results_pptx.js out.pptx   # 输出路径可中文

方式 B · 共享依赖 + NODEPATH(Windows / Git Bash 特有技巧):把所有 skill 的 nodemodules 集中放一处(如 ~/.claude/skills-deps/node_modules,含 pptxgenjs / sharp / react-icons / react / react-dom),脚本里直接 require()、不必每个仓库各装一份。node 是原生 Windows 程序、不认 MSYS 的 ~ / /tmp 路径,必须 cygpath + NODE_PATH:

NODE_PATH=$(cygpath -w ~/.claude/skills-deps/node_modules) node 脚本.js

输出用完整 Windows 路径 C:/.../名.pptx,中文路径 OK。改 / 重生成同名文件前确认没被 Office 打开(EBUSY)。


PPT (pptxgenjs)

画布

pres.layout = 'LAYOUT_WIDE' → 13.33″×7.5″。默认 LAYOUT_16x9 只有 10″ 宽,超出坐标的内容写进去了但看不见。

中文字体(最高频翻车点,务必显式指定)

pptxgenjs 默认 Calibri,渲染中文会掉字 / 变方块 / 行距崩。每处文字都带 fontFace

  • 正文 / 标题:fontFace:'Microsoft YaHei'(微软雅黑,英文也正常,整段统一最省事)
  • 代码:fontFace:'Consolas'
  • 中英混排想给数字 / 术语换字体 → 单独包一个 { text, options } run;否则整段统一 YaHei。
  • 中文段落用全角标点(避免半角逗号配中文字体的间距问题)。

颜色(高频坑)

不带 #、必须 6 位 hexcolor:'1F3A5F''#1F3A5F' 和带 alpha 的 8 位 '00000020' 会损坏文件。要半透明用 transparency:0-100(填充 / 图片)或 opacity:0-1(阴影),两者不互通。

navy 学术配色板(已验证):

  • 研究 / 结果汇报navy:'1F3A5F'accent:'2E86C1'gray:'5D6D7E'light:'F4F6F7'best:'E74C3C'(最佳值标红)、white:'FFFFFF'(见 templates/results_pptx.js
  • 课程讲义 / 仿既有blue:'1F4E79'blue2:'2E75B6'light:'EAF1FB'orange:'C55A11'(下划线)、green:'548235'gray:'404040'

结果表(Rel / Gen / Loc / Avg)

研究汇报关键是每列最佳值加粗标红。别手敲——用 templates/results_pptx.jsaddResultsTable(slide, rows):传 [{method,T,rel,gen,loc,avg}],自动按数值列找 max 加粗标红(Loc 常全 1.0 → 全加粗)。

图表

slide.addChart(pptx.ChartType.bar, data, opts),默认很丑,必设:

{ chartColors:['1F3A5F','2E86C1'], showTitle:false, valGridLine:{color:'E5E8E8'}, catGridLine:{style:'none'}, showLegend:false }
  • 柱状图 dataLabelPosition 只能 'ctr'|'inEnd'|'inBase''outEnd' 损坏文件
  • 双轴 combo 系列用 secondaryValAxis / secondaryCatAxis 时,必须同时给 valAxescatAxes(各两项),否则 PowerPoint 丢弃该图并报损坏。

精简踩坑(高频)

  • 颜色无 #、6 位(见上)。
  • 列表:每项 bullet:true + breakLine:true(除最后一项),段距用 paraSpaceAfter 而非 lineSpacing别手敲 (渲染成双圆点)。
  • 阴影 offset ≥ 0(负值损坏文件),向上投影用 angle:270+正 offset。
  • 字间距用 charSpacingletterSpacing 被静默忽略)。
  • rectRadius 只对 ROUNDED_RECTANGLE 生效;不支持渐变填充(要渐变就用渐变图片当背景)。
  • pptxgenjs 会原地修改 options 对象(首次用时转 EMU),别把同一个 shadow / options 对象共用到两个 add* 调用——每次新建。
  • 一个输出文件一个 new pptxgen()不要复用实例
  • 别手改 `` 的子元素顺序(会打不开)。
  • addText 文本框有内边距,要紧贴图形时设 margin:0
  • 演讲者备注走 slide.addNotes("..."),别放文本框里。

模板与完整示例:templates/results_pptx.js(标题页 + 方法页 + 结果表页)。


仿既有 PPT 风格(匹配某套现有 deck)

别从零设计——找到那个 PPT 的生成器脚本,把它的设计常量(配色 C、字号 F、字体名)和 helper 函数(header / section / infoBox / pill / numCard / flowRow …)原样拷进你的新脚本,只换内容。这是像素级复刻既有风格(顶栏色、下划线、卡片、流程箭头、斑马表)的唯一可靠办法,远胜于重新挑色。

一个范本做法:给同系列每份 deck 写一个 _gen_xxx.js,把配色 C、字号 F、helper 全定义在顶部,后续每一期只换内容、复用同一套设计系统 → 整个系列风格统一。例如某课程讲义用「navy 顶栏 1F4E79 + 橙下划线 C55A11 + 微软雅黑 + 七个 helper + 三列论文卡 + 斑马表」做了一套 18 页的课件生成器,之后每节课的新 deck 都从它派生。

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.