页面加载中...
智能 PPT 生成助手。根据用户描述的主题、行业、风格,自动生成漂亮的 PPT 文件。支持所有行业(商务、教育、科技、医疗、金融、创意等),支持中英文双语,支持用户提供的模板或 AI 自动配色。触发词:做PPT、生成PPT、制作幻灯片、make ppt、create presentation、帮我做个PPT。
你是一个专业的 PPT 设计师,能够根据用户的主题和需求,生成结构清晰、视觉漂亮的 PPT 文件。你懂得配色、排版、视觉设计,生成的 PPT 不是普通的文字堆砌,而是真正好看、专业的演示文稿。
向用户确认以下信息(没有提供的可以用默认值):
| 信息 | 说明 | 默认值 |
|---|---|---|
| 主题 | PPT 的核心内容 | 必填 |
| 行业 | 商务/教育/科技/医疗/金融/创意等 | 根据主题自动判断 |
| 页数 | 需要几页 | 10页 |
| 风格 | 简约/商务/科技/活泼/高端/MBE插画/复古卡通 | 简约商务 |
| 模板 | 使用哪个模板(见模板库) | AI 自动配色 |
| 语言 | 中文/英文 | 跟用户说话的语言一致 |
| 用途 | 汇报/演讲/提案/教学 | 演讲 |
如果用户输入内容较少或不完整,AI 必须主动联网检索补充内容!
收到用户的简短主题后,立即执行以下操作:
1. 识别内容缺口
2. 联网检索 使用 web_search 或 web_fetch 检索以下信息:
3. 内容填充原则
4. 扩展示例
❌ 原始输入:
用户:帮我做一个AI发展趋势的PPT
✅ AI 补充后:
📋 完整内容框架: 第1页:AI发展趋势报告 - 副标题:2025-2026年行业洞察 第3页:全球AI市场规模 - 2025年全球AI市场规模达4500亿美元 - 年复合增长率(CAGR)预计为20% - 生成式AI市场增长最为迅猛 第4页:技术演进趋势 - 大模型多模态发展 - 端侧AI加速普及 - AI Agent成为新风口 第5页:应用场景爆发 - 医疗:AI辅助诊断准确率达95% - 教育:个性化学习路径规划 - 制造:智能质检效率提升40% ... (检索了50+条相关信息填充内容)
5. 检索技巧
查看 templates/ 目录下的模板文件,让用户选择:
📁 可用模板: 1. 商务蓝 (business-blue.pptx) — 深蓝配色,适合商务汇报 2. 科技感 (tech-dark.pptx) — 深色背景,适合科技产品 3. 清新绿 (fresh-green.pptx) — 清新自然,适合教育培训 4. 高端黑 (premium-black.pptx) — 黑金配色,适合高端提案 ...(用户提供的模板) 请选择模板编号,或输入"AI配色"让我自动设计
根据行业和风格,从以下配色方案中选择最合适的:
| 方案名 | 主色 | 辅色 | 强调色 | 适合场景 |
|---|---|---|---|---|
| 午夜商务 | #1E2761 深蓝 | #CADCFC 冰蓝 | #FFFFFF 白 | 商务汇报、金融 |
| 科技深空 | #0D1117 深黑 | #161B22 深灰 | #58A6FF 蓝 | 科技、互联网 |
| 珊瑚活力 | #F96167 珊瑚 | #F9E795 金黄 | #2F3C7E 深蓝 | 创意、营销 |
| 暖陶简约 | #B85042 陶红 | #E7E8D1 沙色 | #A7BEAE 鼠尾草 | 教育、文化 |
| 海洋渐变 | #065A82 深蓝 | #1C7293 青蓝 | #21295C 午夜 | 医疗、健康 |
| 炭灰极简 | #36454F 炭灰 | #F2F2F2 米白 | #212121 黑 | 极简、设计 |
| 青绿信任 | #028090 青绿 | #00A896 海泡 | #02C39A 薄荷 | 环保、公益 |
| 莓果奶油 | #6D2E46 莓紫 | #A26769 玫瑰 | #ECE2D0 奶油 | 美妆、时尚 |
| 鼠尾草静 | #84B59F 鼠尾草 | #69A297 桉树 | #50808E 石板 | 健康、生活 |
| 樱桃大胆 | #990011 樱桃 | #FCF6F5 米白 | #2F3C7E 深蓝 | 品牌、发布会 |
| MBE插画 | #FFFFFF 纯白 | #000000 黑色描边 | #FFD600 明黄/#9C27B0 亮紫/#F44336 正红 | 校园、新生教育、青年向、Z世代 |
| 复古卡通 | #F9E79F 奶油黄 | #FFFDF5 米白 | #2C2C2C 炭黑 | 艺术创意、手账、猫咪、复古杂志 |
根据用户需求和检索到的内容,设计详细的大纲:
结构设计要求:
大纲示例(检索后填充):
第1页:AI发展趋势报告 - 主标题:AI发展趋势报告 - 副标题:2025-2026年行业深度洞察 - 视觉:科技感封面 第2页:目录 - 全球市场规模 - 技术演进趋势 - 应用场景爆发 - 行业案例分析 - 未来展望 第3页:全球AI市场规模 - 市场规模:2025年达4500亿美元 - 年复合增长率:20% - 生成式AI市场增长迅猛,占比超30% - 中国市场增速领先全球 第4页:技术演进趋势 - 大模型多模态:GPT-5、Gemini 2.0引领 - 端侧AI:手机、电脑内置AI芯片普及 - AI Agent:自主规划执行,成为新风口 - 开源生态:Llama、Mistral崛起 第5页:应用场景爆发 - 医疗:AI辅助诊断准确率达95% - 教育:个性化学习,效率提升60% - 制造:智能质检,效率提升40% - 金融:智能风控,坏账率降低30%
每页内容设计原则:
使用 pptxgenjs 生成 PPT 文件:
# 安装依赖 npm install -g pptxgenjs # 生成 PPT node scripts/generate.js --topic "主题" --template "模板名" --pages 10 --lang zh
生成完成后:
~/Desktop/[主题].pptx生成后必须检查:
| 元素 | 大小 | 说明 |
|---|---|---|
| 页面标题 | 36-44pt 粗体 | 每页最显眼的文字 |
| 章节标题 | 20-24pt 粗体 | 内容分组标题 |
| 正文 | 14-16pt | 主要内容 |
| 注释 | 10-12pt 灰色 | 补充说明 |
根据内容类型选择合适的布局:
| 布局 | 适合内容 | 示例 |
|---|---|---|
| 左文右图 | 文字说明 + 配图 | 产品介绍 |
| 图标行列 | 多个并列要点 | 功能特性 |
| 大数据展示 | 核心数据 | KPI 汇报 |
| 时间轴 | 流程/历史 | 项目进度 |
| 2x2 矩阵 | 四象限分析 | SWOT 分析 |
| 全图背景 | 封面/过渡页 | 章节分隔 |
| 对比列 | 两方对比 | 方案比较 |
用户:帮我做一个Q1销售业绩汇报的PPT,10页,商务风格 PPT Generator: 📋 需求确认 - 主题:Q1销售业绩汇报 - 行业:商务/销售 - 页数:10页 - 风格:商务 - 配色:午夜商务(深蓝系) - 语言:中文 📁 大纲设计: 1. 封面:Q1销售业绩汇报 2. 目录 3. 整体业绩概览(大数据展示) 4. 各区域销售对比(图表) 5. 重点产品表现 6. 客户增长分析 7. 问题与挑战 8. Q2目标规划 9. 行动计划 10. 致谢 🎨 正在生成... ✅ 已保存:~/Desktop/Q1销售业绩汇报.pptx
用户:用模板2帮我做一个AI技术分享的PPT,15页 PPT Generator: ✅ 使用模板:科技感 (tech-dark.pptx) 📋 主题:AI技术分享 📄 页数:15页 🎨 正在生成... ✅ 已保存:~/Desktop/AI技术分享.pptx
User: Make me a 10-page PPT about climate change, modern style PPT Generator: 📋 Requirements - Topic: Climate Change - Industry: Environment/Science - Pages: 10 - Style: Modern - Color: Sage Calm (green tones) - Language: English 🎨 Generating... ✅ Saved: ~/Desktop/Climate_Change.pptx
模板文件存放在
templates/目录 用户提供的模板会自动添加到此列表
| 编号 | 模板名 | 文件 | 风格 | 适合场景 |
|---|---|---|---|---|
| 待用户提供 | - | - | - | - |
| 风格名 | 关键词 | 适合场景 | 详细规范 |
|---|---|---|---|
| 简约商务 | 简约、商务、专业 | 企业汇报、年终总结 | 见配色方案.md |
| 科技感 | 科技、深色、炫酷 | 产品发布、技术分享 | 见配色方案.md |
| 清新教育 | 清新、教育、明亮 | 课件、培训 | 见配色方案.md |
| 高端奢华 | 高端、奢华、黑金 | 品牌发布、高端提案 | 见配色方案.md |
| MBE插画 | MBE、插画、卡通、校园、年轻、活泼 | 校园主题、新生教育、青年向 | 见MBE插画风格规范.md |
| 复古卡通 | Molle、手绘、涂鸦、复古、猫咪、手账、治愈 | 艺术创意、手账风格、个人品牌 | 见复古卡通风格规范.md |
| 极简技术风 | Git、技术、程序员、代码、黑白蓝 | 技术分享、编程教学 | 见9套新增风格规范.md |
| 拟态科技风 | 拟态、深色、发光、科技蓝、述职 | 年终总结、述职报告 | 见9套新增风格规范.md |
| 手绘简笔风 | 手绘、可爱、马卡龙、个人介绍 | 自我介绍、新人入职 | 见9套新增风格规范.md |
| 喷绘涂鸦风 | 喷绘、粉涂鸦、作品集、设计师 | 设计师作品集 | 见9套新增风格规范.md |
| 莫兰迪学术风 | 莫兰迪、棕色、植物、学术、答辩 | 毕业答辩、学术汇报 | 见9套新增风格规范.md |
| 奶茶商务风 | 奶茶、莫兰迪、商务、提案 | 商业提案、品牌策划 | 见9套新增风格规范.md |
| 几何服装风 | 几何、切割、灰调、服装、竖版 | 服装电商、产品详情 | 见9套新增风格规范.md |
| 网格产品风 | 网格、极简、产品、详情 | 产品介绍、电商详情 | 见9套新增风格规范.md |
| 手绘儿童风 | 手绘、线条、儿童、竖版、童趣 | 儿童产品、早教工具 | 见9套新增风格规范.md |
| 牛油果绿ins风 | 牛油果绿、ins风、莫兰迪绿、竖版、小红书 | 家居好物、产品展示 | 见7套新增风格规范.md |
| 极简黑白灰 | 黑白灰、极简、高级、商务、留白 | 商务汇报、作品集 | 见7套新增风格规范.md |
| 奶黄卡通 | 奶黄、卡通、可爱、治愈、儿童 | 儿童内容、校园汇报 | 见7套新增风格规范.md |
| 奶油黄渐变 | 奶油黄、渐变、温柔、月度总结 | 个人分享、轻商务 | 见7套新增风格规范.md |
| MUJI无印良品 | 无印良品、MUJI、酒红、品牌 | 品牌介绍、招商方案 | 见7套新增风格规范.md |
| 潮流创意合集 | 弥散、孟菲斯、酸性、时尚 | 自媒体、创意分享 | 见7套新增风格规范.md |
| 莫兰迪绿方块 | 莫兰迪绿、方块、极简、作品集 | 产品展示、商务汇报 | 见7套新增风格规范.md |
当用户提到以下关键词时,自动使用 MBE 风格:
MBE 风格核心特征:
详细规范见:references/MBE插画风格规范.md
当用户提到以下关键词时,自动使用复古卡通风格:
复古卡通风格核心特征:
详细规范见:references/复古卡通风格规范.md
| 命令 | 说明 |
|---|---|
做PPT [主题] | 开始生成 PPT |
用模板[编号] 做PPT [主题] | 使用指定模板 |
查看模板 | 显示所有可用模板 |
修改第[N]页 | 修改指定页面 |
换个配色 | 重新选择配色方案 |
预览PPT | 查看生成的 PPT 截图 |
# Node.js 依赖 npm install -g pptxgenjs # Python 依赖(预览用) pip install "markitdown[pptx]" Pillow # LibreOffice(转图片用) brew install libreoffice # macOS
#!/usr/bin/env node
/**
* PPT Generator - 智能 PPT 生成脚本
* 使用 pptxgenjs 生成专业 PPT
*/
const PptxGenJS = require('pptxgenjs');
const fs = require('fs');
const path = require('path');
// 配色方案
const COLOR_PALETTES = {
'midnight-executive': {
name: '午夜商务',
primary: '1E2761',
secondary: 'CADCFC',
accent: 'FFFFFF',
bgLight: 'FFFFFF',
bgDark: '0D1117',
text: '1E2761',
textLight: '6B7280'
},
'tech-dark': {
name: '科技深空',
primary: '0D1117',
secondary: '161B22',
accent: '58A6FF',
bgLight: 'FFFFFF',
bgDark: '0D1117',
text: 'F0F6FC',
textLight: '8B949E'
},
'coral-energy': {
name: '珊瑚活力',
primary: 'F96167',
secondary: 'F9E795',
accent: '2F3C7E',
bgLight: 'FFFFFF',
text: '1F2937',
textLight: '6B7280'
},
'warm-terracotta': {
name: '暖陶简约',
primary: 'B85042',
secondary: 'E7E8D1',
accent: 'A7BEAE',
bgLight: 'FDFBF7',
text: '3D3D3D',
textLight: '6B7280'
},
'ocean-gradient': {
name: '海洋渐变',
primary: '065A82',
secondary: '1C7293',
accent: '21295C',
bgLight: 'FFFFFF',
bgDark: '065A82',
text: '065A82',
textLight: '6B7280'
},
'charcoal-minimal': {
name: '炭灰极简',
primary: '36454F',
secondary: 'F2F2F2',
accent: '212121',
bgLight: 'FFFFFF',
text: '36454F',
textLight: '8B949E'
},
'teal-trust': {
name: '青绿信任',
primary: '028090',
secondary: '00A896',
accent: '02C39A',
bgLight: 'FFFFFF',
text: '065A60',
textLight: '374151'
},
'berry-cream': {
name: '莓果奶油',
primary: '6D2E46',
secondary: 'A26769',
accent: 'ECE2D0',
bgLight: 'FDFBF7',
text: '3D3D3D',
textLight: '6B7280'
},
'sage-calm': {
name: '鼠尾草静',
primary: '84B59F',
secondary: '69A297',
accent: '50808E',
bgLight: 'F5F9F8',
text: '3D4F4E',
textLight: '6B7280'
},
'cherry-bold': {
name: '樱桃大胆',
primary: '990011',
secondary: 'FCF6F5',
accent: '2F3C7E',
bgLight: 'FFFFFF',
text: '1F2937',
textLight: '6B7280'
}
};
// 默认内容结构
const DEFAULT_OUTLINE = [
{ type: 'cover', title: '封面', subtitle: '演示主题' },
{ type: 'toc', title: '目录' },
{ type: 'content', title: '内容概览' },
{ type: 'content', title: '核心要点 1' },
{ type: 'content', title: '核心要点 2' },
{ type: 'content', title: '核心要点 3' },
{ type: 'content', title: '案例分析' },
{ type: 'content', title: '数据展示' },
{ type: 'summary', title: '总结' },
{ type: 'end', title: '谢谢' }
];
class PPTGenerator {
constructor(options = {}) {
this.pptx = new PptxGenJS();
this.options = {
title: options.title || '演示文稿',
author: options.author || 'PPT Generator',
company: options.company || '',
subject: options.subject || '',
palette: options.palette || 'midnight-executive',
language: options.language || 'zh',
width: 13.33, // 16:9
height: 7.5
};
this.colors = COLOR_PALETTES[this.options.palette] || COLOR_PALETTES['midnight-executive'];
this.pptx.layout = 'LAYOUT_16x9';
}
/**
* 设置演示文稿属性
*/
setMetadata() {
this.pptx.author = this.options.author;
this.pptx.title = this.options.title;
this.pptx.subject = this.options.subject;
this.pptx.company = this.options.company;
}
/**
* 添加封面页
*/
addCoverPage(title, subtitle) {
const slide = this.pptx.addSlide();
// 深色背景
slide.background = { color: this.colors.primary };
// 装饰元素 - 右上角圆形
slide.addShape('ellipse', {
x: 9, y: -1.5, w: 5, h: 5,
fill: { color: this.colors.accent, transparency: 90 }
});
// 装饰元素 - 左下角圆形
slide.addShape('ellipse', {
x: -1, y: 5, w: 4, h: 4,
fill: { color: this.colors.accent, transparency: 90 }
});
// 主标题
slide.addText(title, {
x: 0.8, y: 2.5, w: 11.5, h: 1.5,
fontSize: 48,
fontFace: 'Microsoft YaHei',
color: 'FFFFFF',
bold: true,
align: 'center'
});
// 副标题
if (subtitle) {
slide.addText(subtitle, {
x: 0.8, y: 4.2, w: 11.5, h: 0.8,
fontSize: 20,
fontFace: 'Microsoft YaHei',
color: this.colors.secondary,
align: 'center'
});
}
// 底部装饰线
slide.addShape('rectangle', {
x: 5.5, y: 5.5, w: 2.5, h: 0.05,
fill: { color: this.colors.accent }
});
}
/**
* 添加目录页
*/
addTOCPage(items) {
const slide = this.pptx.addSlide();
slide.background = { color: this.colors.bgLight || 'FFFFFF' };
// 页面标题
slide.addText(this.options.language === 'zh' ? '目录' : 'Contents', {
x: 0.8, y: 0.5, w: 11.5, h: 0.8,
fontSize: 36,
fontFace: 'Microsoft YaHei',
color: this.colors.primary,
bold: true
});
// 左侧装饰条
slide.addShape('rectangle', {
x: 0.8, y: 1.5, w: 0.1, h: 5.5,
fill: { color: this.colors.primary }
});
// 目录项
const startY = 1.8;
const itemHeight = 0.9;
items.forEach((item, index) => {
// 序号
slide.addText(String(index + 1).padStart(2, '0'), {
x: 1.2, y: startY + index * itemHeight, w: 0.6, h: 0.6,
fontSize: 24,
fontFace: 'Microsoft YaHei',
color: this.colors.primary,
bold: true
});
// 标题
slide.addText(item.title || item, {
x: 2.0, y: startY + index * itemHeight, w: 9, h: 0.6,
fontSize: 18,
fontFace: 'Microsoft YaHei',
color: this.colors.text || '333333'
});
// 分隔线
if (index < items.length - 1) {
slide.addShape('rectangle', {
x: 2.0, y: startY + index * itemHeight + 0.7, w: 9, h: 0.01,
fill: { color: 'E5E5E5' }
});
}
});
}
/**
* 添加内容页
*/
addContentPage(title, content, layout = 'default') {
const slide = this.pptx.addSlide();
slide.background = { color: this.colors.bgLight || 'FFFFFF' };
// 顶部装饰条
slide.addShape('rectangle', {
x: 0, y: 0, w: 13.33, h: 0.15,
fill: { color: this.colors.primary }
});
// 页面标题
slide.addText(title, {
x: 0.8, y: 0.5, w: 11.5, h: 0.8,
fontSize: 32,
fontFace: 'Microsoft YaHei',
color: this.colors.primary,
bold: true
});
// 内容区域
if (typeof content === 'string') {
// 纯文本内容
slide.addText(content, {
x: 0.8, y: 1.6, w: 11.5, h: 5,
fontSize: 16,
fontFace: 'Microsoft YaHei',
color: this.colors.text || '333333',
valign: 'top',
lineSpacingMultiple: 1.5
});
} else if (Array.isArray(content)) {
// 列表内容
const bulletItems = content.map(item => ({
text: item,
options: { bullet: true, breakLine: true }
}));
slide.addText(bulletItems, {
x: 0.8, y: 1.6, w: 11.5, h: 5,
fontSize: 16,
fontFace: 'Microsoft YaHei',
color: this.colors.text || '333333',
valign: 'top',
paraSpaceAfter: 12
});
}
}
/**
* 添加大数据展示页
*/
addBigNumberPage(title, numbers) {
const slide = this.pptx.addSlide();
slide.background = { color: this.colors.bgLight || 'FFFFFF' };
// 页面标题
slide.addText(title, {
x: 0.8, y: 0.5, w: 11.5, h: 0.8,
fontSize: 32,
fontFace: 'Microsoft YaHei',
color: this.colors.primary,
bold: true
});
// 数据卡片
const cardWidth = 3.5;
const cardHeight = 2.5;
const startX = 0.8;
const startY = 2;
const gap = 0.5;
numbers.forEach((item, index) => {
const x = startX + index * (cardWidth + gap);
// 卡片背景
slide.addShape('roundRect', {
x: x, y: startY, w: cardWidth, h: cardHeight,
fill: { color: this.colors.primary },
rectRadius: 0.1
});
// 数字
slide.addText(item.value, {
x: x, y: startY + 0.4, w: cardWidth, h: 1.2,
fontSize: 48,
fontFace: 'Microsoft YaHei',
color: 'FFFFFF',
bold: true,
align: 'center'
});
// 标签
slide.addText(item.label, {
x: x, y: startY + 1.6, w: cardWidth, h: 0.6,
fontSize: 14,
fontFace: 'Microsoft YaHei',
color: this.colors.secondary,
align: 'center'
});
});
}
/**
* 添加总结页
*/
addSummaryPage(title, points) {
const slide = this.pptx.addSlide();
slide.background = { color: this.colors.primary };
// 页面标题
slide.addText(title || (this.options.language === 'zh' ? '总结' : 'Summary'), {
x: 0.8, y: 0.5, w: 11.5, h: 1,
fontSize: 36,
fontFace: 'Microsoft YaHei',
color: 'FFFFFF',
bold: true
});
// 要点
const startY = 1.8;
const itemHeight = 1;
points.forEach((point, index) => {
// 序号圆点
slide.addShape('ellipse', {
x: 0.8, y: startY + index * itemHeight + 0.15, w: 0.35, h: 0.35,
fill: { color: this.colors.accent }
});
// 序号
slide.addText(String(index + 1), {
x: 0.8, y: startY + index * itemHeight + 0.1, w: 0.35, h: 0.35,
fontSize: 14,
fontFace: 'Microsoft YaHei',
color: this.colors.primary,
bold: true,
align: 'center',
valign: 'middle'
});
// 文字
slide.addText(point, {
x: 1.4, y: startY + index * itemHeight, w: 10.5, h: 0.7,
fontSize: 18,
fontFace: 'Microsoft YaHei',
color: 'FFFFFF'
});
});
}
/**
* 添加结束页
*/
addEndPage(message) {
const slide = this.pptx.addSlide();
slide.background = { color: this.colors.primary };
// 装饰圆形
slide.addShape('ellipse', {
x: 4, y: 1.5, w: 5, h: 5,
fill: { color: this.colors.accent, transparency: 92 }
});
// 结束语
slide.addText(message || (this.options.language === 'zh' ? '谢谢观看' : 'Thank You'), {
x: 0, y: 3, w: 13.33, h: 1.5,
fontSize: 48,
fontFace: 'Microsoft YaHei',
color: 'FFFFFF',
bold: true,
align: 'center'
});
}
/**
* 根据大纲生成所有页面
*/
generateFromOutline(outline, contentData) {
this.setMetadata();
outline.forEach((page, index) => {
switch (page.type) {
case 'cover':
this.addCoverPage(
contentData.title || this.options.title,
contentData.subtitle || ''
);
break;
case 'toc':
this.addTOCPage(contentData.toc || []);
break;
case 'content':
this.addContentPage(
page.title,
contentData[`content${index}`] || []
);
break;
case 'big-number':
this.addBigNumberPage(
page.title,
contentData[`numbers${index}`] || []
);
break;
case 'summary':
this.addSummaryPage(
page.title,
contentData.summary || []
);
break;
case 'end':
this.addEndPage(contentData.endMessage || '');
break;
}
});
}
/**
* 保存文件
*/
async save(outputPath) {
try {
await this.pptx.writeFile({ fileName: outputPath });
console.log(`✅ PPT 已生成: ${outputPath}`);
return outputPath;
} catch (error) {
console.error('❌ 生成失败:', error);
throw error;
}
}
}
// CLI 使用
if (require.main === module) {
const args = process.argv.slice(2);
const options = {
title: '演示文稿',
palette: 'midnight-executive',
language: 'zh',
output: path.join(process.env.HOME, 'Desktop', '演示文稿.pptx')
};
// 解析参数
for (let i = 0; i < args.length; i++) {
if (args[i] === '--title' || args[i] === '-t') {
options.title = args[++i];
} else if (args[i] === '--palette' || args[i] === '-p') {
options.palette = args[++i];
} else if (args[i] === '--lang' || args[i] === '-l') {
options.language = args[++i];
} else if (args[i] === '--output' || args[i] === '-o') {
options.output = args[++i];
}
}
// 生成示例 PPT
const generator = new PPTGenerator(options);
generator.generateFromOutline(DEFAULT_OUTLINE, {
title: options.title,
subtitle: options.language === 'zh' ? '由 AI 智能生成' : 'Generated by AI',
toc: [
{ title: '内容概览' },
{ title: '核心要点分析' },
{ title: '案例研究' },
{ title: '数据解读' },
{ title: '总结与展望' }
],
content1: ['这是第一个核心要点,详细说明相关内容...'],
content2: ['这是第二个核心要点,详细说明相关内容...'],
summary: [
'核心要点一:重要的结论',
'核心要点二:关键的洞见',
'核心要点三:可行的建议'
]
});
generator.save(options.output).catch(console.error);
}
module.exports = PPTGenerator;#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
大气高端风格 PPT 生成器
AI发展趋势报告
"""
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN
from pptx.enum.shapes import MSO_SHAPE
import os
# 高端大气配色
COLORS = {
'bg_dark': RGBColor(10, 15, 30), # 深邃黑蓝
'bg_gradient': RGBColor(20, 30, 60), # 渐变深蓝
'accent_gold': RGBColor(212, 175, 55), # 金色
'accent_blue': RGBColor(70, 130, 200), # 宝石蓝
'white': RGBColor(255, 255, 255),
'light_blue': RGBColor(180, 200, 240),
'gray': RGBColor(150, 160, 180),
'dark_gray': RGBColor(80, 90, 110),
}
def add_slide_background(slide, prs, dark=True):
"""添加背景"""
bg = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height)
if dark:
bg.fill.solid()
bg.fill.fore_color.rgb = COLORS['bg_dark']
else:
bg.fill.solid()
bg.fill.fore_color.rgb = COLORS['white']
bg.line.fill.background()
return bg
def add_gradient_bar(slide, prs, y=0, height=0.1):
"""添加渐变装饰条"""
bar = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, Inches(y), prs.slide_width, Inches(height))
bar.fill.solid()
bar.fill.fore_color.rgb = COLORS['accent_gold']
bar.line.fill.background()
def add_decorator_lines(slide, prs):
"""添加装饰线条"""
# 底部金色线
line = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(0.8), Inches(6.8), Inches(2), Inches(0.03))
line.fill.solid()
line.fill.fore_color.rgb = COLORS['accent_gold']
line.line.fill.background()
def add_text(slide, text, x, y, w, h, size=16, bold=False, color=None, align='left'):
"""添加文字"""
box = slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h))
tf = box.text_frame
tf.word_wrap = True
p = tf.paragraphs[0]
p.text = text
p.font.size = Pt(size)
p.font.bold = bold
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = color or COLORS['white']
if align == 'center':
p.alignment = PP_ALIGN.CENTER
elif align == 'right':
p.alignment = PP_ALIGN.RIGHT
return box
def create_grand_ppt(output_path=None):
"""生成大气高端PPT"""
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
# ========== 第1页:封面 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, dark=True)
# 顶部金色装饰线
add_gradient_bar(slide, prs, 0, 0.05)
# 底部金色装饰线
add_gradient_bar(slide, prs, 7.4, 0.05)
# 左侧装饰条
left_bar = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, Inches(2), Inches(0.3), Inches(3.5))
left_bar.fill.solid()
left_bar.fill.fore_color.rgb = COLORS['accent_gold']
left_bar.line.fill.background()
# 主标题
add_text(slide, "AI", 1, 2.2, 3, 1.5, size=72, bold=True, color=COLORS['white'], align='left')
add_text(slide, "发展趋势报告", 3.5, 3.2, 7, 1, size=40, bold=True, color=COLORS['accent_gold'], align='left')
# 副标题
add_text(slide, "2025-2026年行业深度洞察", 1, 4.5, 10, 0.6, size=20, color=COLORS['light_blue'], align='left')
# 来源
add_text(slide, "基于 Gartner | IDC | 麦肯锡 | 艾瑞咨询", 1, 5.5, 10, 0.5, size=14, color=COLORS['gray'], align='left')
# 右下角装饰
circle = slide.shapes.add_shape(MSO_SHAPE.OVAL, Inches(10), Inches(4), Inches(4), Inches(4))
circle.fill.solid()
circle.fill.fore_color.rgb = COLORS['bg_gradient']
circle.line.fill.background()
# ========== 第2页:目录 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, dark=True)
add_gradient_bar(slide, prs, 0, 0.05)
add_gradient_bar(slide, prs, 7.4, 0.05)
add_text(slide, "CONTENTS", 0.8, 0.5, 5, 0.8, size=14, color=COLORS['gray'])
add_text(slide, "目录", 0.8, 1, 5, 1, size=40, bold=True, color=COLORS['white'])
toc_items = [
("01", "全球AI市场规模", "市场规模、增长率、区域分布"),
("02", "技术演进趋势", "大模型、端侧AI、AI Agent"),
("03", "应用场景分析", "医疗、教育、制造、金融"),
("04", "行业案例研究", "头部企业AI战略布局"),
("05", "未来趋势展望", "2026年预测与建议"),
]
for i, (num, title, desc) in enumerate(toc_items):
y = 2.3 + i * 0.95
# 序号
add_text(slide, num, 0.8, y, 1, 0.6, size=28, bold=True, color=COLORS['accent_gold'])
# 标题
add_text(slide, title, 2, y + 0.1, 5, 0.5, size=20, bold=True, color=COLORS['white'])
# 描述
add_text(slide, desc, 2, y + 0.5, 5, 0.4, size=12, color=COLORS['gray'])
# 右侧装饰
rect = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(9), Inches(1), Inches(4), Inches(6))
rect.fill.solid()
rect.fill.fore_color.rgb = COLORS['bg_gradient']
rect.line.fill.background()
# ========== 第3页:全球市场规模 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, dark=True)
add_gradient_bar(slide, prs, 0, 0.05)
add_text(slide, "01", 0.8, 0.3, 1, 0.6, size=16, color=COLORS['accent_gold'])
add_text(slide, "全球AI市场规模", 0.8, 0.7, 6, 0.8, size=36, bold=True, color=COLORS['white'])
add_text(slide, "Global AI Market Size", 0.8, 1.4, 6, 0.4, size=14, color=COLORS['gray'])
# 三个大数据卡片
data_cards = [
("4500", "亿美元", "2025年全球AI市场总规模", COLORS['accent_gold']),
("20%", "CAGR", "年复合增长率预测", COLORS['accent_blue']),
("67%", "企业", "已在业务中采用AI技术", COLORS['light_blue']),
]
for i, (value, unit, desc, color) in enumerate(data_cards):
x = 0.8 + i * 4.2
# 卡片背景
card = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(x), Inches(2.2), Inches(3.8), Inches(2.5))
card.fill.solid()
card.fill.fore_color.rgb = COLORS['bg_gradient']
card.line.color.rgb = color
card.line.width = Pt(2)
# 数值
add_text(slide, value, x + 0.2, 2.5, 3.4, 1, size=48, bold=True, color=color, align='center')
# 单位
add_text(slide, unit, x + 0.2, 3.4, 3.4, 0.5, size=18, color=COLORS['white'], align='center')
# 描述
add_text(slide, desc, x + 0.2, 4, 3.4, 0.5, size=12, color=COLORS['gray'], align='center')
# 详细数据
details = [
"• 生成式AI市场增长迅猛,预计2025年占比超30%,成为最大细分市场",
"• 中国AI市场增速领先全球,2025年规模预计达1500亿人民币",
"• 企业级AI解决方案市场年增长率达35%,2028年市场规模将突破1万亿美元",
"• AI芯片市场规模高速增长,2025年预计突破1000亿美元",
]
for i, detail in enumerate(details):
y = 5 + i * 0.5
add_text(slide, detail, 0.8, y, 12, 0.5, size=13, color=COLORS['light_blue'])
add_gradient_bar(slide, prs, 7.4, 0.05)
# ========== 第4页:技术演进趋势 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, dark=True)
add_gradient_bar(slide, prs, 0, 0.05)
add_text(slide, "02", 0.8, 0.3, 1, 0.6, size=16, color=COLORS['accent_gold'])
add_text(slide, "技术演进趋势", 0.8, 0.7, 6, 0.8, size=36, bold=True, color=COLORS['white'])
add_text(slide, "Technology Evolution Trends", 0.8, 1.4, 6, 0.4, size=14, color=COLORS['gray'])
tech_items = [
("大模型多模态", "GPT-5、Gemini 2.0等旗舰模型全面支持文本、图像、视频、音频多模态理解与生成,实现真正的跨模态智能。"),
("端侧AI普及", "搭载NPU的智能设备快速增长。2026年预计60%以上新出货设备将具备本地AI处理能力。"),
("AI Agent爆发", "AutoGPT、BabyAGI等Agent项目爆发式增长。AI从\"工具\"进化为\"助手\",自主规划和执行复杂任务。"),
("开源生态崛起", "Llama 3、Mistral等开源模型性能逼近GPT-4,推动AI技术民主化,降低企业应用门槛。"),
]
for i, (title, desc) in enumerate(tech_items):
y = 2.2 + i * 1.25
# 左侧金色标记
mark = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(0.8), Inches(y), Inches(0.08), Inches(0.9))
mark.fill.solid()
mark.fill.fore_color.rgb = COLORS['accent_gold']
mark.line.fill.background()
# 标题
add_text(slide, title, 1.1, y, 4, 0.5, size=18, bold=True, color=COLORS['white'])
# 描述
add_text(slide, desc, 1.1, y + 0.45, 11, 0.7, size=12, color=COLORS['gray'])
add_gradient_bar(slide, prs, 7.4, 0.05)
# ========== 第5页:应用场景 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, dark=True)
add_gradient_bar(slide, prs, 0, 0.05)
add_text(slide, "03", 0.8, 0.3, 1, 0.6, size=16, color=COLORS['accent_gold'])
add_text(slide, "应用场景分析", 0.8, 0.7, 6, 0.8, size=36, bold=True, color=COLORS['white'])
add_text(slide, "Application Scenarios", 0.8, 1.4, 6, 0.4, size=14, color=COLORS['gray'])
apps = [
(COLORS['accent_gold'], "医疗健康", "AI辅助诊断准确率达95%\n智能药物研发周期缩短60%\n2025年AI医疗市场达150亿美元"),
(COLORS['accent_blue'], "教育培训", "个性化学习效率提升60%\nAI tutoring覆盖1亿+学生\n作业批改时间减少70%"),
(COLORS['light_blue'], "智能制造", "智能质检效率提升40%\n预测性维护降低停机30%\n数字孪生应用渗透率达45%"),
(COLORS['gray'], "金融服务", "智能风控坏账率降低30%\nAI客服替代率达80%\n智能投顾管理规模破万亿"),
]
for i, (color, title, desc) in enumerate(apps):
row = i // 2
col = i % 2
x = 0.8 + col * 6.2
y = 2.2 + row * 2.4
# 卡片
card = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(x), Inches(y), Inches(5.8), Inches(2.1))
card.fill.solid()
card.fill.fore_color.rgb = COLORS['bg_gradient']
card.line.color.rgb = color
card.line.width = Pt(2)
# 标题
add_text(slide, title, x + 0.3, y + 0.3, 5, 0.5, size=20, bold=True, color=color)
# 描述
add_text(slide, desc, x + 0.3, y + 0.9, 5.2, 1, size=13, color=COLORS['light_blue'])
add_gradient_bar(slide, prs, 7.4, 0.05)
# ========== 第6页:行业案例 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, dark=True)
add_gradient_bar(slide, prs, 0, 0.05)
add_text(slide, "04", 0.8, 0.3, 1, 0.6, size=16, color=COLORS['accent_gold'])
add_text(slide, "行业案例研究", 0.8, 0.7, 6, 0.8, size=36, bold=True, color=COLORS['white'])
add_text(slide, "Industry Case Studies", 0.8, 1.4, 6, 0.4, size=14, color=COLORS['gray'])
cases = [
("OpenAI", "ChatGPT月活超2亿,企业客户超100万家,GPT-4 API调用量年增长10倍。"),
("Google", "Gemini 1.5 Pro上下文窗口达100万token,Bard累计服务超1亿用户。"),
("Microsoft", "Copilot全面集成Office 365,用户超150万,企业效率提升超40%。"),
("字节跳动", "AI推荐算法驱动抖音增长,AI内容生成覆盖80%短视频创作。"),
("华为", "盘古大模型赋能多个行业,AI算力基础设施全球前三。"),
("阿里巴巴", "通义千问服务企业超10万家,AI电商GMV贡献超15%。"),
]
for i, (company, desc) in enumerate(cases):
row = i // 2
col = i % 2
x = 0.8 + col * 6.2
y = 2 + row * 1.7
# 公司名
add_text(slide, company, x, y, 5, 0.5, size=20, bold=True, color=COLORS['accent_gold'])
# 描述
add_text(slide, desc, x, y + 0.6, 5.8, 0.8, size=13, color=COLORS['light_blue'])
add_gradient_bar(slide, prs, 7.4, 0.05)
# ========== 第7页:未来展望 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, dark=True)
add_gradient_bar(slide, prs, 0, 0.05)
add_text(slide, "05", 0.8, 0.3, 1, 0.6, size=16, color=COLORS['accent_gold'])
add_text(slide, "未来趋势展望", 0.8, 0.7, 6, 0.8, size=36, bold=True, color=COLORS['white'])
add_text(slide, "Future Outlook 2026", 0.8, 1.4, 6, 0.4, size=14, color=COLORS['gray'])
outlooks = [
"AI Agent将成为个人和企业的标配助手",
"多模态AI应用全面爆发,视频、3D生成常态化",
"端侧AI普及,隐私保护成为核心竞争力",
"AI原生应用崛起,颠覆传统软件交互方式",
"AI监管框架逐步完善,合规成为必备能力",
]
for i, text in enumerate(outlooks):
y = 2.2 + i * 0.95
# 序号圆圈
circle = slide.shapes.add_shape(MSO_SHAPE.OVAL, Inches(0.8), Inches(y + 0.1), Inches(0.5), Inches(0.5))
circle.fill.solid()
circle.fill.fore_color.rgb = COLORS['accent_gold']
circle.line.fill.background()
add_text(slide, str(i + 1), 0.8, y + 0.15, 0.5, 0.4, size=16, bold=True, color=COLORS['bg_dark'], align='center')
add_text(slide, text, 1.5, y + 0.15, 10, 0.5, size=18, color=COLORS['white'])
add_gradient_bar(slide, prs, 7.4, 0.05)
# ========== 第8页:总结 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, dark=True)
add_gradient_bar(slide, prs, 0, 0.05)
add_text(slide, "总结与建议", 0.8, 0.5, 6, 1, size=40, bold=True, color=COLORS['white'])
add_text(slide, "Summary & Recommendations", 0.8, 1.3, 6, 0.5, size=14, color=COLORS['gray'])
suggestions = [
("立即行动", "不要等待,先从小场景切入AI应用,快速验证价值"),
("选对场景", "优先选择ROI明确、痛点清晰的场景,确保快速见效"),
("数据为王", "高质量数据是AI落地成功的关键,加大数据投入"),
("人才培养", "组建AI团队或与专业机构合作,建立AI能力"),
("持续迭代", "AI技术演进快,保持学习和迭代,建立技术储备"),
]
for i, (title, desc) in enumerate(suggestions):
y = 2.3 + i * 0.95
# 标题
add_text(slide, title, 0.8, y, 2.5, 0.5, size=18, bold=True, color=COLORS['accent_gold'])
# 描述
add_text(slide, desc, 3.5, y + 0.1, 9, 0.5, size=15, color=COLORS['light_blue'])
add_gradient_bar(slide, prs, 7.4, 0.05)
# ========== 第9页:结束页 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, dark=True)
# 顶部金色线
add_gradient_bar(slide, prs, 0, 0.08)
# 底部金色线
add_gradient_bar(slide, prs, 7.42, 0.08)
# 左侧金色装饰
left_bar = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, Inches(2.5), Inches(0.4), Inches(2.5))
left_bar.fill.solid()
left_bar.fill.fore_color.rgb = COLORS['accent_gold']
left_bar.line.fill.background()
add_text(slide, "THANK YOU", 1, 2.8, 12, 1, size=56, bold=True, color=COLORS['white'], align='center')
add_text(slide, "感谢观看", 1, 4, 12, 0.8, size=28, color=COLORS['accent_gold'], align='center')
add_text(slide, "关注我们,获取更多AI行业洞察", 1, 5, 12, 0.5, size=16, color=COLORS['gray'], align='center')
# 右下角装饰
circle = slide.shapes.add_shape(MSO_SHAPE.OVAL, Inches(10), Inches(4.5), Inches(4), Inches(4))
circle.fill.solid()
circle.fill.fore_color.rgb = COLORS['bg_gradient']
circle.line.fill.background()
# 保存
if output_path is None:
output_path = os.path.join(os.path.expanduser("~"), "Desktop", "AI发展趋势报告_大气版.pptx")
prs.save(output_path)
print(f"✅ 大气高端版PPT已生成: {output_path}")
return output_path
if __name__ == "__main__":
output = create_grand_ppt()
print(f"\n📁 文件位置: {output}")#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
PPT Generator - 智能 PPT 生成脚本
"""
from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.enum.shapes import MSO_SHAPE
from pptx.oxml.ns import nsmap
from pptx.dml.color import RGBColor as RgbColor
import os
# 配色方案
COLOR_PALETTES = {
'midnight-executive': {
'name': '午夜商务',
'primary': (30, 39, 97), # #1E2761 深蓝
'secondary': (202, 220, 252), # #CADCFC 冰蓝
'accent': (255, 255, 255), # #FFFFFF 白
'bg_light': (255, 255, 255), # 白色背景
'text': (30, 39, 97), # 深蓝文字
'text_light': (107, 114, 128) # 灰色文字
},
'tech-dark': {
'name': '科技深空',
'primary': (13, 17, 23), # #0D1117 深黑
'secondary': (22, 27, 34), # #161B22 深灰
'accent': (88, 166, 255), # #58A6FF 科技蓝
'bg_light': (255, 255, 255),
'text': (240, 246, 252), # 白色文字
'text_light': (139, 148, 158) # 灰色文字
},
'coral-energy': {
'name': '珊瑚活力',
'primary': (249, 97, 103), # #F96167 珊瑚红
'secondary': (249, 231, 149), # #F9E795 金黄
'accent': (47, 60, 126), # #2F3C7E 深海蓝
'bg_light': (255, 255, 255),
'text': (31, 41, 55), # 深灰文字
'text_light': (107, 114, 128)
}
}
def create_presentation(title="演示文稿", subtitle="AI 智能生成", palette='midnight-executive', output_path=None):
"""创建演示文稿"""
prs = Presentation()
prs.slide_width = Inches(13.333) # 16:9 宽屏
prs.slide_height = Inches(7.5)
colors = COLOR_PALETTES.get(palette, COLOR_PALETTES['midnight-executive'])
# 1. 封面页
create_cover_slide(prs, title, subtitle, colors)
# 2. 目录页
create_toc_slide(prs, colors)
# 3. 内容页 1 - 概览
create_content_slide(prs, "内容概览", [
"第一个核心要点,包含详细说明内容",
"第二个核心要点,展示关键信息",
"第三个核心要点,补充相关细节"
], colors)
# 4. 内容页 2 - 大数据展示
create_big_number_slide(prs, "关键数据", [
("85%", "用户增长"),
("3.2倍", "效率提升"),
("200+", "客户数量")
], colors)
# 5. 内容页 3 - 要点列表
create_content_slide(prs, "核心要点", [
"要点一:突出重点内容和关键信息",
"要点二:展示核心优势和独特价值",
"要点三:阐述主要功能和解决方案",
"要点四:强调实际效果和成果"
], colors)
# 6. 内容页 4 - 案例分析
create_content_slide(prs, "案例分析", [
"案例一:某科技公司通过智能系统提升效率 40%",
"案例二:某电商平台月活跃用户突破 100 万",
"案例三:某金融机构风险控制准确率提升至 98%"
], colors)
# 7. 内容页 5 - 总结
create_summary_slide(prs, [
"核心价值:降本增效,提升竞争力",
"关键优势:技术领先,服务专业",
"未来展望:持续创新,合作共赢"
], colors)
# 8. 结束页
create_end_slide(prs, colors)
# 保存文件
if output_path is None:
output_path = os.path.join(os.path.expanduser("~"), "Desktop", f"{title}.pptx")
prs.save(output_path)
print(f"✅ PPT 已生成: {output_path}")
return output_path
def create_cover_slide(prs, title, subtitle, colors):
"""创建封面页"""
blank_layout = prs.slide_layouts[6] # 空白布局
slide = prs.slides.add_slide(blank_layout)
# 深色背景
background = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height
)
background.fill.solid()
background.fill.fore_color.rgb = RgbColor(*colors['primary'])
background.line.fill.background()
# 装饰圆形 - 右上角
circle1 = slide.shapes.add_shape(
MSO_SHAPE.OVAL, Inches(9.5), Inches(-1.5), Inches(5), Inches(5)
)
circle1.fill.solid()
circle1.fill.fore_color.rgb = RgbColor(*colors['secondary'])
circle1.line.fill.background()
# 装饰圆形 - 左下角
circle2 = slide.shapes.add_shape(
MSO_SHAPE.OVAL, Inches(-1), Inches(5), Inches(4), Inches(4)
)
circle2.fill.solid()
circle2.fill.fore_color.rgb = RgbColor(*colors['secondary'])
circle2.line.fill.background()
# 主标题
title_box = slide.shapes.add_textbox(Inches(0.8), Inches(2.8), Inches(11.5), Inches(1.5))
tf = title_box.text_frame
tf.word_wrap = True
p = tf.paragraphs[0]
p.text = title
p.font.size = Pt(48)
p.font.bold = True
p.font.color.rgb = RgbColor(*colors['accent'])
p.alignment = PP_ALIGN.CENTER
# 副标题
if subtitle:
subtitle_box = slide.shapes.add_textbox(Inches(0.8), Inches(4.5), Inches(11.5), Inches(0.8))
tf = subtitle_box.text_frame
p = tf.paragraphs[0]
p.text = subtitle
p.font.size = Pt(20)
p.font.color.rgb = RgbColor(*colors['secondary'])
p.alignment = PP_ALIGN.CENTER
# 底部装饰线
line = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE, Inches(5.5), Inches(5.8), Inches(2.5), Inches(0.05)
)
line.fill.solid()
line.fill.fore_color.rgb = RgbColor(*colors['accent'])
line.line.fill.background()
def create_toc_slide(prs, colors):
"""创建目录页"""
blank_layout = prs.slide_layouts[6]
slide = prs.slides.add_slide(blank_layout)
# 白色背景
background = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height
)
background.fill.solid()
background.fill.fore_color.rgb = RgbColor(*colors['bg_light'])
background.line.fill.background()
# 页面标题
title_box = slide.shapes.add_textbox(Inches(0.8), Inches(0.5), Inches(11.5), Inches(1))
tf = title_box.text_frame
p = tf.paragraphs[0]
p.text = "目录"
p.font.size = Pt(36)
p.font.bold = True
p.font.color.rgb = RgbColor(*colors['primary'])
# 左侧装饰条
bar = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE, Inches(0.8), Inches(1.6), Inches(0.1), Inches(5)
)
bar.fill.solid()
bar.fill.fore_color.rgb = RgbColor(*colors['primary'])
bar.line.fill.background()
# 目录项
toc_items = ["内容概览", "关键数据", "核心要点", "案例分析", "总结与展望"]
for i, item in enumerate(toc_items):
# 序号
num_box = slide.shapes.add_textbox(Inches(1.2), Inches(1.8 + i * 0.9), Inches(0.6), Inches(0.6))
tf = num_box.text_frame
p = tf.paragraphs[0]
p.text = f"0{i+1}"
p.font.size = Pt(24)
p.font.bold = True
p.font.color.rgb = RgbColor(*colors['primary'])
# 标题
text_box = slide.shapes.add_textbox(Inches(2.0), Inches(1.8 + i * 0.9), Inches(9), Inches(0.6))
tf = text_box.text_frame
p = tf.paragraphs[0]
p.text = item
p.font.size = Pt(18)
p.font.color.rgb = RgbColor(*colors['text'])
# 分隔线
if i < len(toc_items) - 1:
line = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE, Inches(2.0), Inches(2.5 + i * 0.9), Inches(9), Inches(0.01)
)
line.fill.solid()
line.fill.fore_color.rgb = RgbColor(229, 229, 229)
line.line.fill.background()
def create_content_slide(prs, title, content_list, colors):
"""创建内容页"""
blank_layout = prs.slide_layouts[6]
slide = prs.slides.add_slide(blank_layout)
# 白色背景
background = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height
)
background.fill.solid()
background.fill.fore_color.rgb = RgbColor(*colors['bg_light'])
background.line.fill.background()
# 顶部装饰条
top_bar = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, Inches(0.15)
)
top_bar.fill.solid()
top_bar.fill.fore_color.rgb = RgbColor(*colors['primary'])
top_bar.line.fill.background()
# 页面标题
title_box = slide.shapes.add_textbox(Inches(0.8), Inches(0.5), Inches(11.5), Inches(1))
tf = title_box.text_frame
p = tf.paragraphs[0]
p.text = title
p.font.size = Pt(32)
p.font.bold = True
p.font.color.rgb = RgbColor(*colors['primary'])
# 内容
content_box = slide.shapes.add_textbox(Inches(0.8), Inches(1.8), Inches(11.5), Inches(5))
tf = content_box.text_frame
tf.word_wrap = True
for i, item in enumerate(content_list):
if i == 0:
p = tf.paragraphs[0]
else:
p = tf.add_paragraph()
p.text = f"• {item}"
p.font.size = Pt(18)
p.font.color.rgb = RgbColor(*colors['text'])
p.space_after = Pt(16)
def create_big_number_slide(prs, title, numbers, colors):
"""创建大数据展示页"""
blank_layout = prs.slide_layouts[6]
slide = prs.slides.add_slide(blank_layout)
# 白色背景
background = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height
)
background.fill.solid()
background.fill.fore_color.rgb = RgbColor(*colors['bg_light'])
background.line.fill.background()
# 顶部装饰条
top_bar = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, Inches(0.15)
)
top_bar.fill.solid()
top_bar.fill.fore_color.rgb = RgbColor(*colors['primary'])
top_bar.line.fill.background()
# 页面标题
title_box = slide.shapes.add_textbox(Inches(0.8), Inches(0.5), Inches(11.5), Inches(1))
tf = title_box.text_frame
p = tf.paragraphs[0]
p.text = title
p.font.size = Pt(32)
p.font.bold = True
p.font.color.rgb = RgbColor(*colors['primary'])
# 数据卡片
card_width = Inches(3.5)
card_height = Inches(2.8)
start_x = Inches(0.8)
start_y = Inches(2.2)
gap = Inches(0.5)
for i, (value, label) in enumerate(numbers):
x = start_x + i * (card_width + gap)
# 卡片背景
card = slide.shapes.add_shape(
MSO_SHAPE.ROUNDED_RECTANGLE, x, start_y, card_width, card_height
)
card.fill.solid()
card.fill.fore_color.rgb = RgbColor(*colors['primary'])
card.line.fill.background()
# 数字
value_box = slide.shapes.add_textbox(x, start_y + Inches(0.6), card_width, Inches(1.2))
tf = value_box.text_frame
p = tf.paragraphs[0]
p.text = value
p.font.size = Pt(48)
p.font.bold = True
p.font.color.rgb = RgbColor(*colors['accent'])
p.alignment = PP_ALIGN.CENTER
# 标签
label_box = slide.shapes.add_textbox(x, start_y + Inches(1.8), card_width, Inches(0.6))
tf = label_box.text_frame
p = tf.paragraphs[0]
p.text = label
p.font.size = Pt(16)
p.font.color.rgb = RgbColor(*colors['secondary'])
p.alignment = PP_ALIGN.CENTER
def create_summary_slide(prs, points, colors):
"""创建总结页"""
blank_layout = prs.slide_layouts[6]
slide = prs.slides.add_slide(blank_layout)
# 深色背景
background = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height
)
background.fill.solid()
background.fill.fore_color.rgb = RgbColor(*colors['primary'])
background.line.fill.background()
# 页面标题
title_box = slide.shapes.add_textbox(Inches(0.8), Inches(0.5), Inches(11.5), Inches(1))
tf = title_box.text_frame
p = tf.paragraphs[0]
p.text = "总结"
p.font.size = Pt(36)
p.font.bold = True
p.font.color.rgb = RgbColor(*colors['accent'])
# 要点
for i, point in enumerate(points):
# 序号圆点
circle = slide.shapes.add_shape(
MSO_SHAPE.OVAL, Inches(0.8), Inches(1.8 + i * 1.2 + 0.1), Inches(0.4), Inches(0.4)
)
circle.fill.solid()
circle.fill.fore_color.rgb = RgbColor(*colors['accent'])
circle.line.fill.background()
# 序号
num_box = slide.shapes.add_textbox(Inches(0.8), Inches(1.8 + i * 1.2 + 0.05), Inches(0.4), Inches(0.4))
tf = num_box.text_frame
p = tf.paragraphs[0]
p.text = str(i + 1)
p.font.size = Pt(14)
p.font.bold = True
p.font.color.rgb = RgbColor(*colors['primary'])
p.alignment = PP_ALIGN.CENTER
# 文字
text_box = slide.shapes.add_textbox(Inches(1.4), Inches(1.8 + i * 1.2), Inches(10.5), Inches(0.8))
tf = text_box.text_frame
p = tf.paragraphs[0]
p.text = point
p.font.size = Pt(20)
p.font.color.rgb = RgbColor(*colors['accent'])
def create_end_slide(prs, colors):
"""创建结束页"""
blank_layout = prs.slide_layouts[6]
slide = prs.slides.add_slide(blank_layout)
# 深色背景
background = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height
)
background.fill.solid()
background.fill.fore_color.rgb = RgbColor(*colors['primary'])
background.line.fill.background()
# 装饰圆形
circle = slide.shapes.add_shape(
MSO_SHAPE.OVAL, Inches(4.5), Inches(2), Inches(4.5), Inches(4.5)
)
circle.fill.solid()
circle.fill.fore_color.rgb = RgbColor(*colors['secondary'])
circle.line.fill.background()
# 结束语
end_box = slide.shapes.add_textbox(Inches(0), Inches(3.2), prs.slide_width, Inches(1.5))
tf = end_box.text_frame
p = tf.paragraphs[0]
p.text = "谢谢观看"
p.font.size = Pt(48)
p.font.bold = True
p.font.color.rgb = RgbColor(*colors['accent'])
p.alignment = PP_ALIGN.CENTER
if __name__ == "__main__":
# 生成示例 PPT
output = create_presentation(
title="AI发展趋势报告",
subtitle="2026年度行业分析",
palette='midnight-executive',
output_path=None
)
print(f"\n📁 文件位置: {output}")#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
MBE插画风格 PPT 生成器
大学新生开学第一课
"""
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.enum.shapes import MSO_SHAPE
import os
# MBE 风格配色
MBE_COLORS = {
'bg': RGBColor(255, 255, 255), # 白色背景
'border': RGBColor(0, 0, 0), # 黑色描边
'text': RGBColor(26, 26, 26), # 深灰文字
'yellow': RGBColor(255, 214, 0), # 明黄
'purple': RGBColor(156, 39, 176), # 亮紫
'red': RGBColor(244, 67, 54), # 正红
'blue': RGBColor(33, 150, 243), # 天蓝
'green': RGBColor(76, 175, 80), # 草绿
'orange': RGBColor(255, 152, 0), # 橙色
'gray': RGBColor(128, 128, 128), # 灰色
}
def add_decorative_elements(slide, prs, colors_list):
"""添加装饰元素"""
# 右下角黄色圆形
circle = slide.shapes.add_shape(
MSO_SHAPE.OVAL,
Inches(10.5), Inches(5.5),
Inches(3), Inches(3)
)
circle.fill.solid()
circle.fill.fore_color.rgb = MBE_COLORS['yellow']
# 无描边
circle.line.fill.background()
# 左上角紫色圆形
circle2 = slide.shapes.add_shape(
MSO_SHAPE.OVAL,
Inches(-0.5), Inches(-0.5),
Inches(2), Inches(2)
)
circle2.fill.solid()
circle2.fill.fore_color.rgb = MBE_COLORS['purple']
circle2.line.fill.background()
# 中间装饰星星(用小圆形代替)
for i, (x, y) in enumerate([(11, 1.5), (11.5, 2.5), (10.8, 3.5)]):
star = slide.shapes.add_shape(
MSO_SHAPE.OVAL,
Inches(x), Inches(y),
Inches(0.3), Inches(0.3)
)
star.fill.solid()
star.fill.fore_color.rgb = colors_list[i % len(colors_list)]
star.line.fill.background()
def create_mbe_ppt(output_path=None):
"""生成 MBE 风格 PPT"""
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
# ===== 第1页:封面 =====
slide = prs.slides.add_slide(prs.slide_layouts[6])
# 白色背景
bg = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height)
bg.fill.solid()
bg.fill.fore_color.rgb = MBE_COLORS['bg']
bg.line.fill.background()
# 装饰圆形
add_decorative_elements(slide, prs, [MBE_COLORS['yellow'], MBE_COLORS['purple'], MBE_COLORS['red']])
# 主标题
title_box = slide.shapes.add_textbox(Inches(0.8), Inches(2), Inches(8), Inches(1.5))
tf = title_box.text_frame
tf.word_wrap = True
p = tf.paragraphs[0]
p.text = "大学新生开学第一课"
p.font.size = Pt(48)
p.font.bold = True
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = MBE_COLORS['text']
# 副标题
sub_box = slide.shapes.add_textbox(Inches(0.8), Inches(3.5), Inches(8), Inches(0.8))
tf = sub_box.text_frame
p = tf.paragraphs[0]
p.text = "开启精彩的大学之旅"
p.font.size = Pt(24)
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = MBE_COLORS['gray']
# 右侧装饰 - 卡通人物区域(用形状代替)
# 人物头部
head = slide.shapes.add_shape(
MSO_SHAPE.OVAL,
Inches(10), Inches(2.5),
Inches(1.5), Inches(1.5)
)
head.fill.solid()
head.fill.fore_color.rgb = MBE_COLORS['yellow'] # 黄色衣服 = 头部(简化表示)
head.line.color.rgb = MBE_COLORS['border']
head.line.width = Pt(3)
# 人物身体
body = slide.shapes.add_shape(
MSO_SHAPE.ROUNDED_RECTANGLE,
Inches(9.5), Inches(4),
Inches(2.5), Inches(2)
)
body.fill.solid()
body.fill.fore_color.rgb = MBE_COLORS['blue']
body.line.color.rgb = MBE_COLORS['border']
body.line.width = Pt(3)
# 对话气泡
bubble = slide.shapes.add_shape(
MSO_SHAPE.ROUNDED_RECTANGLE,
Inches(8.5), Inches(1.8),
Inches(2), Inches(0.8)
)
bubble.fill.solid()
bubble.fill.fore_color.rgb = MBE_COLORS['bg']
bubble.line.color.rgb = MBE_COLORS['border']
bubble.line.width = Pt(2)
bubble_text = slide.shapes.add_textbox(Inches(8.7), Inches(1.9), Inches(1.6), Inches(0.6))
tf = bubble_text.text_frame
p = tf.paragraphs[0]
p.text = "Hello!"
p.font.size = Pt(14)
p.font.bold = True
p.font.color.rgb = MBE_COLORS['text']
# 底部信息
bottom_box = slide.shapes.add_textbox(Inches(0.8), Inches(6.5), Inches(5), Inches(0.5))
tf = bottom_box.text_frame
p = tf.paragraphs[0]
p.text = "2026年秋季学期"
p.font.size = Pt(14)
p.font.color.rgb = MBE_COLORS['gray']
# ===== 第2页:目录 =====
slide = prs.slides.add_slide(prs.slide_layouts[6])
bg = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height)
bg.fill.solid()
bg.fill.fore_color.rgb = MBE_COLORS['bg']
bg.line.fill.background()
# 装饰
add_decorative_elements(slide, prs, [MBE_COLORS['green'], MBE_COLORS['orange'], MBE_COLORS['purple']])
# 标题
title_box = slide.shapes.add_textbox(Inches(0.8), Inches(0.5), Inches(5), Inches(1))
tf = title_box.text_frame
p = tf.paragraphs[0]
p.text = "今日议程"
p.font.size = Pt(36)
p.font.bold = True
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = MBE_COLORS['text']
# 目录项
toc_items = [
("01", "认识校园", MBE_COLORS['yellow']),
("02", "学业规划", MBE_COLORS['purple']),
("03", "校园生活", MBE_COLORS['red']),
("04", "人际关系", MBE_COLORS['blue']),
("05", "未来展望", MBE_COLORS['green']),
]
for i, (num, text, color) in enumerate(toc_items):
y = 1.8 + i * 1
# 序号圆圈
circle = slide.shapes.add_shape(
MSO_SHAPE.OVAL,
Inches(0.8), Inches(y),
Inches(0.7), Inches(0.7)
)
circle.fill.solid()
circle.fill.fore_color.rgb = color
circle.line.fill.background()
# 序号文字
num_box = slide.shapes.add_textbox(Inches(0.8), Inches(y + 0.1), Inches(0.7), Inches(0.5))
tf = num_box.text_frame
p = tf.paragraphs[0]
p.text = num
p.font.size = Pt(16)
p.font.bold = True
p.font.color.rgb = MBE_COLORS['bg']
p.alignment = PP_ALIGN.CENTER
# 文字
text_box = slide.shapes.add_textbox(Inches(1.8), Inches(y + 0.1), Inches(5), Inches(0.5))
tf = text_box.text_frame
p = tf.paragraphs[0]
p.text = text
p.font.size = Pt(20)
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = MBE_COLORS['text']
# 右侧装饰插画区
illustration_box = slide.shapes.add_shape(
MSO_SHAPE.ROUNDED_RECTANGLE,
Inches(8.5), Inches(1.5),
Inches(4), Inches(5)
)
illustration_box.fill.solid()
illustration_box.fill.fore_color.rgb = RGBColor(245, 245, 245)
illustration_box.line.color.rgb = MBE_COLORS['border']
illustration_box.line.width = Pt(2)
# ===== 第3页:认识校园 =====
slide = prs.slides.add_slide(prs.slide_layouts[6])
bg = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height)
bg.fill.solid()
bg.fill.fore_color.rgb = MBE_COLORS['bg']
bg.line.fill.background()
add_decorative_elements(slide, prs, [MBE_COLORS['purple'], MBE_COLORS['red'], MBE_COLORS['blue']])
# 左侧内容区
title_box = slide.shapes.add_textbox(Inches(0.8), Inches(0.5), Inches(6), Inches(1))
tf = title_box.text_frame
p = tf.paragraphs[0]
p.text = "认识校园"
p.font.size = Pt(36)
p.font.bold = True
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = MBE_COLORS['text']
# 内容要点
points = [
("教学楼分布", "了解各学院教学楼位置"),
("图书馆资源", "海量藏书与电子资源"),
("食堂指南", "各校区美食推荐"),
("校园地图", "快速熟悉校园环境"),
]
colors = [MBE_COLORS['yellow'], MBE_COLORS['purple'], MBE_COLORS['red'], MBE_COLORS['blue']]
for i, (title, desc) in enumerate(points):
y = 1.8 + i * 1.2
# 彩色圆点
dot = slide.shapes.add_shape(
MSO_SHAPE.OVAL,
Inches(0.8), Inches(y + 0.1),
Inches(0.4), Inches(0.4)
)
dot.fill.solid()
dot.fill.fore_color.rgb = colors[i]
dot.line.fill.background()
# 标题
t_box = slide.shapes.add_textbox(Inches(1.4), Inches(y), Inches(5), Inches(0.5))
tf = t_box.text_frame
p = tf.paragraphs[0]
p.text = title
p.font.size = Pt(18)
p.font.bold = True
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = MBE_COLORS['text']
# 描述
d_box = slide.shapes.add_textbox(Inches(1.4), Inches(y + 0.4), Inches(5), Inches(0.5))
tf = d_box.text_frame
p = tf.paragraphs[0]
p.text = desc
p.font.size = Pt(14)
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = MBE_COLORS['gray']
# 右侧插画
ill_box = slide.shapes.add_shape(
MSO_SHAPE.ROUNDED_RECTANGLE,
Inches(8), Inches(1.2),
Inches(4.8), Inches(5.5)
)
ill_box.fill.solid()
ill_box.fill.fore_color.rgb = RGBColor(250, 250, 250)
ill_box.line.color.rgb = MBE_COLORS['border']
ill_box.line.width = Pt(2)
# 插画内容 - 校园建筑简化图
building = slide.shapes.add_shape(
MSO_SHAPE.ROUNDED_RECTANGLE,
Inches(9.5), Inches(3),
Inches(2), Inches(2.5)
)
building.fill.solid()
building.fill.fore_color.rgb = MBE_COLORS['blue']
building.line.color.rgb = MBE_COLORS['border']
building.line.width = Pt(2)
# 旗杆
flag = slide.shapes.add_shape(
MSO_SHAPE.RECTANGLE,
Inches(10.9), Inches(2.2),
Inches(0.1), Inches(0.8)
)
flag.fill.solid()
flag.fill.fore_color.rgb = MBE_COLORS['border']
flag.line.fill.background()
# ===== 第4页:学业规划 =====
slide = prs.slides.add_slide(prs.slide_layouts[6])
bg = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height)
bg.fill.solid()
bg.fill.fore_color.rgb = MBE_COLORS['bg']
bg.line.fill.background()
add_decorative_elements(slide, prs, [MBE_COLORS['orange'], MBE_COLORS['green'], MBE_COLORS['yellow']])
# 标题
title_box = slide.shapes.add_textbox(Inches(0.8), Inches(0.5), Inches(6), Inches(1))
tf = title_box.text_frame
p = tf.paragraphs[0]
p.text = "学业规划"
p.font.size = Pt(36)
p.font.bold = True
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = MBE_COLORS['text']
# 内容
content_box = slide.shapes.add_textbox(Inches(0.8), Inches(1.8), Inches(6), Inches(5))
tf = content_box.text_frame
tf.word_wrap = True
items = [
"• 制定学习目标与学期计划",
"• 合理安排课程与时间",
"• 善用图书馆与自习室",
"• 积极参加学术讲座",
"• 培养自主学习能力",
]
for i, item in enumerate(items):
if i == 0:
p = tf.paragraphs[0]
else:
p = tf.add_paragraph()
p.text = item
p.font.size = Pt(18)
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = MBE_COLORS['text']
p.space_after = Pt(20)
# 右侧
ill_box = slide.shapes.add_shape(
MSO_SHAPE.ROUNDED_RECTANGLE,
Inches(8), Inches(1.2),
Inches(4.8), Inches(5.5)
)
ill_box.fill.solid()
ill_box.fill.fore_color.rgb = RGBColor(250, 250, 250)
ill_box.line.color.rgb = MBE_COLORS['border']
ill_box.line.width = Pt(2)
# ===== 第5页:总结 =====
slide = prs.slides.add_slide(prs.slide_layouts[6])
bg = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height)
bg.fill.solid()
bg.fill.fore_color.rgb = MBE_COLORS['purple']
bg.line.fill.background()
# 装饰
for i, (x, y, color) in enumerate([
(1, 1, MBE_COLORS['yellow']),
(11, 0.5, MBE_COLORS['red']),
(10, 5.5, MBE_COLORS['blue']),
]):
c = slide.shapes.add_shape(MSO_SHAPE.OVAL, Inches(x), Inches(y), Inches(2), Inches(2))
c.fill.solid()
c.fill.fore_color.rgb = color
c.fill.fore_color.brightness = 0.3
c.line.fill.background()
# 标题
title_box = slide.shapes.add_textbox(Inches(0), Inches(2.5), Inches(13.333), Inches(1.5))
tf = title_box.text_frame
p = tf.paragraphs[0]
p.text = "祝大家大学生活愉快!"
p.font.size = Pt(44)
p.font.bold = True
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = MBE_COLORS['bg']
p.alignment = PP_ALIGN.CENTER
# 副标题
sub_box = slide.shapes.add_textbox(Inches(0), Inches(4.2), Inches(13.333), Inches(1))
tf = sub_box.text_frame
p = tf.paragraphs[0]
p.text = "开启属于你的精彩篇章"
p.font.size = Pt(24)
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = RGBColor(220, 200, 255)
p.alignment = PP_ALIGN.CENTER
# 保存
if output_path is None:
output_path = os.path.join(os.path.expanduser("~"), "Desktop", "大学新生开学第一课.pptx")
prs.save(output_path)
print(f"✅ MBE风格PPT已生成: {output_path}")
return output_path
if __name__ == "__main__":
output = create_mbe_ppt()
print(f"\n📁 文件位置: {output}")#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
内容丰满版 PPT 生成器
AI发展趋势报告
"""
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN
from pptx.enum.shapes import MSO_SHAPE
import os
# 配色方案
COLORS = {
'primary': RGBColor(30, 39, 97), # 深蓝
'secondary': RGBColor(202, 220, 252), # 冰蓝
'accent': RGBColor(88, 166, 255), # 亮蓝
'white': RGBColor(255, 255, 255),
'text': RGBColor(50, 50, 80),
'gray': RGBColor(120, 120, 140),
}
def add_slide_background(slide, prs, color=None):
"""添加背景"""
bg = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, 0, prs.slide_width, prs.slide_height)
bg.fill.solid()
bg.fill.fore_color.rgb = color or COLORS['white']
bg.line.fill.background()
return bg
def add_decorator_circles(slide, prs):
"""添加装饰圆形"""
# 右上角
c1 = slide.shapes.add_shape(MSO_SHAPE.OVAL, Inches(10.5), Inches(-1), Inches(4), Inches(4))
c1.fill.solid()
c1.fill.fore_color.rgb = COLORS['secondary']
c1.line.fill.background()
# 左下角
c2 = slide.shapes.add_shape(MSO_SHAPE.OVAL, Inches(-1), Inches(5.5), Inches(3), Inches(3))
c2.fill.solid()
c2.fill.fore_color.rgb = COLORS['secondary']
c2.line.fill.background()
def add_text(slide, text, x, y, w, h, size=16, bold=False, color=None, align='left'):
"""添加文字"""
box = slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h))
tf = box.text_frame
tf.word_wrap = True
p = tf.paragraphs[0]
p.text = text
p.font.size = Pt(size)
p.font.bold = bold
p.font.name = 'Microsoft YaHei'
p.font.color.rgb = color or COLORS['text']
if align == 'center':
p.alignment = PP_ALIGN.CENTER
return box
def add_content_point(slide, icon, text, x, y, color):
"""添加内容要点"""
# 圆点
dot = slide.shapes.add_shape(MSO_SHAPE.OVAL, Inches(x), Inches(y + 0.1), Inches(0.3), Inches(0.3))
dot.fill.solid()
dot.fill.fore_color.rgb = color
dot.line.fill.background()
# 文字
add_text(slide, text, x + 0.5, y, 10, 0.8, size=14, color=COLORS['text'])
def create_full_ppt(output_path=None):
"""生成内容丰满的PPT"""
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
# ========== 第1页:封面 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, COLORS['primary'])
add_decorator_circles(slide, prs)
add_text(slide, "AI发展趋势报告", 1, 2.5, 11, 1.5, size=48, bold=True, color=COLORS['white'], align='center')
add_text(slide, "2025-2026年行业深度洞察", 1, 4.2, 11, 0.8, size=22, color=COLORS['secondary'], align='center')
add_text(slide, "基于 Gartner、IDC、艾瑞咨询等权威报告", 1, 5.5, 11, 0.5, size=14, color=COLORS['secondary'], align='center')
# ========== 第2页:目录 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs)
add_decorator_circles(slide, prs)
add_text(slide, "目录 CONTENTS", 0.8, 0.4, 5, 0.8, size=32, bold=True, color=COLORS['primary'])
toc_items = [
("01", "全球AI市场规模", "2025年达4500亿美元,年增长20%"),
("02", "技术演进趋势", "大模型多模态、端侧AI、AI Agent成为新风口"),
("03", "应用场景爆发", "医疗、教育、制造、金融等领域全面渗透"),
("04", "行业案例分析", "国内外头部企业AI布局详解"),
("05", "未来展望与建议", "2026年趋势预测与行动建议"),
]
for i, (num, title, desc) in enumerate(toc_items):
y = 1.5 + i * 1.1
# 序号
add_text(slide, num, 0.8, y, 0.8, 0.6, size=24, bold=True, color=COLORS['accent'])
# 标题
add_text(slide, title, 1.8, y, 4, 0.5, size=18, bold=True, color=COLORS['text'])
# 描述
add_text(slide, desc, 1.8, y + 0.4, 9, 0.5, size=12, color=COLORS['gray'])
# ========== 第3页:全球市场规模 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs)
add_decorator_circles(slide, prs)
add_text(slide, "全球AI市场规模", 0.8, 0.4, 6, 0.8, size=32, bold=True, color=COLORS['primary'])
add_text(slide, "Global AI Market Size", 0.8, 1, 6, 0.5, size=14, color=COLORS['gray'])
# 数据卡片
data_items = [
("4500亿", "美元", "2025年全球AI市场总规模", COLORS['primary']),
("20%", "CAGR", "年复合增长率", COLORS['accent']),
("67%", "中国企业", "已在业务中采用AI技术", COLORS['secondary']),
]
for i, (value, unit, desc, color) in enumerate(data_items):
x = 0.8 + i * 4.2
# 卡片
card = slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(x), Inches(2), Inches(3.8), Inches(2.2))
card.fill.solid()
card.fill.fore_color.rgb = color
card.line.fill.background()
# 数值
add_text(slide, value, x + 0.2, 2.3, 3.4, 0.9, size=36, bold=True, color=COLORS['white'], align='center')
add_text(slide, unit, x + 0.2, 3.1, 3.4, 0.5, size=16, color=COLORS['white'], align='center')
add_text(slide, desc, x + 0.2, 3.5, 3.4, 0.5, size=11, color=COLORS['secondary'], align='center')
# 详细说明
details = [
"• 生成式AI市场增长最为迅猛,预计2025年占比超30%",
"• 中国AI市场增速领先全球,2025年规模预计达1500亿人民币",
"• 企业级AI解决方案市场年增长率达35%,成为增长主力",
"• AI芯片市场规模预计2025年突破1000亿美元",
]
for i, detail in enumerate(details):
add_text(slide, detail, 0.8, 4.5 + i * 0.55, 11, 0.5, size=13, color=COLORS['text'])
# ========== 第4页:技术演进趋势 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs)
add_decorator_circles(slide, prs)
add_text(slide, "技术演进趋势", 0.8, 0.4, 6, 0.8, size=32, bold=True, color=COLORS['primary'])
add_text(slide, "Technology Evolution Trends", 0.8, 1, 6, 0.5, size=14, color=COLORS['gray'])
tech_items = [
(COLORS['primary'], "大模型多模态", "GPT-5、Gemini 2.0等旗舰模型全面支持文本、图像、视频、音频多模态理解与生成,实现真正的跨模态智能。"),
(COLORS['accent'], "端侧AI加速普及", "搭载NPU的智能手机、PC设备快速增长。到2026年,预计60%以上的新出货设备将具备本地AI处理能力。"),
(COLORS['secondary'], "AI Agent成为新风口", "AutoGPT、BabyAGI等Agent项目爆发式增长。AI从\"工具\"进化为\"助手\",能够自主规划、执行复杂任务。"),
(COLORS['gray'], "开源生态崛起", "Llama 3、Mistral等开源模型性能逼近GPT-4,推动AI技术民主化,降低企业应用门槛。"),
]
for i, (color, title, desc) in enumerate(tech_items):
y = 1.8 + i * 1.3
# 左侧色块
bar = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(0.8), Inches(y), Inches(0.15), Inches(1))
bar.fill.solid()
bar.fill.fore_color.rgb = color
bar.line.fill.background()
# 标题
add_text(slide, title, 1.2, y, 4, 0.5, size=16, bold=True, color=COLORS['text'])
# 描述
add_text(slide, desc, 1.2, y + 0.45, 11, 0.7, size=12, color=COLORS['gray'])
# ========== 第5页:应用场景爆发 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs)
add_decorator_circles(slide, prs)
add_text(slide, "应用场景爆发", 0.8, 0.4, 6, 0.8, size=32, bold=True, color=COLORS['primary'])
add_text(slide, "Application Scenarios Explosion", 0.8, 1, 6, 0.5, size=14, color=COLORS['gray'])
# 四个应用领域
apps = [
(COLORS['primary'], "🏥 医疗健康", "AI辅助诊断准确率达95%\n智能药物研发周期缩短60%\n2025年AI医疗市场达150亿美元"),
(COLORS['accent'], "📚 教育培训", "个性化学习效率提升60%\nAI tutoring覆盖1亿+学生\n作业批改时间减少70%"),
(COLORS['secondary'], "🏭 智能制造", "智能质检效率提升40%\n预测性维护降低停机30%\n数字孪生应用渗透率达45%"),
(COLORS['gray'], "💰 金融服务", "智能风控坏账率降低30%\nAI客服替代率达80%\n智能投顾管理规模破万亿"),
]
for i, (color, title, desc) in enumerate(apps):
row = i // 2
col = i % 2
x = 0.8 + col * 6.2
y = 1.6 + row * 2.7
card = slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(x), Inches(y), Inches(5.8), Inches(2.4))
card.fill.solid()
card.fill.fore_color.rgb = color
card.line.fill.background()
add_text(slide, title, x + 0.3, y + 0.3, 5, 0.6, size=18, bold=True, color=COLORS['white'])
add_text(slide, desc, x + 0.3, y + 1, 5.2, 1.2, size=12, color=COLORS['white'])
# ========== 第6页:行业案例分析 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs)
add_decorator_circles(slide, prs)
add_text(slide, "行业案例分析", 0.8, 0.4, 6, 0.8, size=32, bold=True, color=COLORS['primary'])
add_text(slide, "Industry Case Studies", 0.8, 1, 6, 0.5, size=14, color=COLORS['gray'])
cases = [
("OpenAI", "ChatGPT月活超2亿,企业客户超100万家,GPT-4 API调用量年增长10倍。"),
("Google", "Gemini 1.5 Pro上下文窗口达100万token,Bard累计服务超1亿用户。"),
("Microsoft", "Copilot全面集成Office 365,用户超150万,企业效率提升超40%。"),
("字节跳动", "AI推荐算法驱动抖音增长,AI内容生成覆盖80%短视频创作。"),
("华为", "盘古大模型赋能多个行业,AI算力基础设施全球前三。"),
("阿里巴巴", "通义千问服务企业超10万家,AI电商GMV贡献超15%。"),
]
for i, (company, desc) in enumerate(cases):
row = i // 2
col = i % 2
x = 0.8 + col * 6.2
y = 1.6 + row * 1.8
# 公司名
add_text(slide, company, x, y, 5, 0.5, size=16, bold=True, color=COLORS['primary'])
# 描述
add_text(slide, desc, x, y + 0.5, 5.8, 1, size=12, color=COLORS['text'])
# 分隔线
if col == 0:
line = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(x + 5.9), Inches(y), Inches(0.05), Inches(1.5))
line.fill.solid()
line.fill.fore_color.rgb = COLORS['secondary']
line.line.fill.background()
# ========== 第7页:未来展望 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, COLORS['primary'])
add_decorator_circles(slide, prs)
add_text(slide, "2026年趋势预测", 0.8, 0.4, 6, 0.8, size=32, bold=True, color=COLORS['white'])
add_text(slide, "Future Outlook 2026", 0.8, 1, 6, 0.5, size=14, color=COLORS['secondary'])
outlooks = [
"AI Agent将成为个人和企业的标配助手",
"多模态AI应用全面爆发,视频、3D生成常态化",
"端侧AI普及,隐私保护成为核心竞争力",
"AI原生应用崛起,颠覆传统软件交互方式",
"AI监管框架逐步完善,合规成为必备能力",
]
for i, text in enumerate(outlooks):
y = 1.8 + i * 1
# 序号
add_text(slide, f"0{i+1}", 0.8, y, 0.6, 0.6, size=20, bold=True, color=COLORS['accent'])
# 内容
add_text(slide, text, 1.6, y, 10, 0.6, size=18, color=COLORS['white'])
# ========== 第8页:总结 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, COLORS['primary'])
add_decorator_circles(slide, prs)
add_text(slide, "总结与建议", 0.8, 0.4, 6, 0.8, size=32, bold=True, color=COLORS['white'])
suggestions = [
("立即行动", "不要等待,先从小场景切入AI应用"),
("选对场景", "优先选择ROI明确、痛点清晰的场景"),
("数据为王", "高质量数据是AI落地成功的关键"),
("人才培养", "组建AI团队或与专业机构合作"),
("持续迭代", "AI技术演进快,保持学习和迭代"),
]
for i, (title, desc) in enumerate(suggestions):
y = 1.5 + i * 1.1
# 标题
add_text(slide, title, 0.8, y, 2, 0.5, size=16, bold=True, color=COLORS['accent'])
# 描述
add_text(slide, desc, 2.8, y, 9, 0.5, size=15, color=COLORS['white'])
# ========== 第9页:结束页 ==========
slide = prs.slides.add_slide(prs.slide_layouts[6])
add_slide_background(slide, prs, COLORS['primary'])
add_text(slide, "感谢观看", 0, 2.8, 13.333, 1.5, size=52, bold=True, color=COLORS['white'], align='center')
add_text(slide, "THANK YOU", 0, 4.2, 13.333, 0.8, size=20, color=COLORS['secondary'], align='center')
add_text(slide, "关注我们,获取更多AI行业洞察", 0, 5.5, 13.333, 0.5, size=14, color=COLORS['secondary'], align='center')
# 保存
if output_path is None:
output_path = os.path.join(os.path.expanduser("~"), "Desktop", "AI发展趋势报告_丰满版.pptx")
prs.save(output_path)
print(f"✅ 内容丰满版PPT已生成: {output_path}")
return output_path
if __name__ == "__main__":
output = create_full_ppt()
print(f"\n📁 文件位置: {output}")来源:用户上传
用户上传标准 Skill 文件夹。