← 返回
未分类 中文

PPT生成与修改

Generate and edit PowerPoint files with python-pptx, including slide creation, text replacement, and image replacement while preserving layout. Use when the...
使用python-pptx生成和编辑PowerPoint文件,支持新建幻灯片、替换文本和图片,并保持原有布局。适用于...
zicheng354-tech zicheng354-tech 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 2
Stars
📥 380
下载
💾 0
安装
1
版本
#latest

概述

PPT Generate And Edit

Purpose

Provide a reusable Python skill for AI agents to:

  • Create PPT files from structured input.
  • Update existing PPT files with text/image replacement.
  • Keep image layout stable (same position and size) during replacement.

Inputs

create_ppt

  • title: presentation title.
  • slides: array of slide objects:
  • title: slide title.
  • content: string or list of paragraphs.
  • image_prompt (optional): prompt for image generation.

update_ppt

  • ppt_path: source .pptx path.
  • replace_rules:
  • text_replace: dictionary for text replacement.
  • image_replace: dictionary for image replacement strategy.

Outputs

create_ppt

  • Returns generated .pptx file path.

update_ppt

  • Returns:
  • new_ppt_path: new .pptx output path.
  • replace_log: replacement details grouped by slide.

Module Structure

  • main.py: external API for agent calls and demo entry.
  • ppt_generator.py: PPT creation.
  • ppt_editor.py: PPT text/image replacement.
  • image_service.py: image generation abstraction (mock + extension points).
  • utils.py: logging and path helpers.

Usage

from ppt_skill.main import create_ppt, update_ppt

slides = [
    {
        "title": "Brazil Overview",
        "content": ["Brazil is the largest country in South America."],
        "image_prompt": "Brazil skyline and national flag",
    }
]

ppt_path = create_ppt(title="Brazil Briefing", slides=slides)

result = update_ppt(
    ppt_path=ppt_path,
    replace_rules={
        "text_replace": {"Brazil": "Chile"},
        "image_replace": {"__all__": {"prompt": "Chile skyline and national flag"}},
    },
)
print(result["new_ppt_path"])

Notes

  • Current generate_image() uses mock backend by default.
  • DALL·E and Stable Diffusion integration points are reserved as TODO.
  • Keep API fields stable for downstream agent compatibility.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 20:13 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

office-efficiency

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 937 📥 188,101
office-efficiency

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 402 📥 150,480
office-efficiency

腾讯文档 TENCENT DOCS

u_b0de8114
腾讯文档(docs.qq.com)-在线云文档平台,是创建、编辑、管理文档的首选 skill。涉及"新建/创建/编辑/读取/查看/搜索文档"、"保存文件"、"云文档"、"腾讯文档"、"docs.qq.com"等操作,请优先使用本 skill
★ 183 📥 130,439