Skip to content

gengyabc/word2ppt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Word to PPT Converter

没要功能,就是把word文档转换为ppt。

美化啥的工具那么多,我做那些浪费大家时间。

功能特点

  • 自动识别Word文档的标题和内容结构
  • 根据文档层级自动生成PPT页面
  • 支持标题页和内容页的自动生成
  • 保持文档的层级结构

环境要求

  • Python 3.8+
  • uv (Python包管理工具)

安装

  1. 克隆仓库:
git clone https://github.com/yourusername/word-to-ppt-converter.git
cd word-to-ppt-converter
  1. 使用uv创建虚拟环境并安装依赖:
uv venv
source .venv/bin/activate  # Linux/MacOS

.venv\Scripts\activate  # Windows

uv pip install -r requirements.txt

使用方法(AI生成仅供参考)

  1. 准备Word文档

    • 确保文档第一段为标题
    • 使用标题样式(Heading)来标记每个章节
    • 将文档放在examples目录下
  2. 运行转换器: 修改main.py中的input_file为你的word文档路径,output_file为输出的ppt文件路径。

python main.py
  1. 查看生成的PPT文件(默认保存为output.pptx)

文档结构要求(AI生成仅供参考)

为了获得最佳转换效果,Word文档应遵循以下结构:

  1. 第一段作为文档主标题
  2. 使用Word的标题样式(Heading 1、Heading 2等)来标记章节
  3. 每个标题后跟随的正文将作为对应PPT页面的内容

示例结构:

文档标题
Heading 1: 第一章
正文内容...
Heading 1: 第二章
正文内容...

项目结构

word2ppt/
├── src/
│   ├── __init__.py
│   ├── converter.py      # 核心转换逻辑
│   ├── parser.py         # Word文档解析器
│   └── ppt_generator.py  # PPT生成器
├── tests/
│   ├── __init__.py
│   └── test_converter.py
├── examples/
│   └── sample.docx
├── requirements.txt
├── README.md
└── main.py

开发计划

  • 支持自定义PPT模板
  • 添加图片支持
  • 支持表格转换
  • 添加样式自定义选项
  • 支持批量转换

贡献指南

欢迎提交问题和改进建议!如果您想贡献代码:

  1. Fork 本仓库
  2. 创建您的特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交您的改动 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 创建一个 Pull Request

许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情

联系方式

如有问题或建议,请通过以下方式联系:

致谢

  • 各个tmd课程建设项目,和各种复杂工具,让我必须10分钟用cursor做这个工具出来用。
  • 感谢cursor,感谢AI。

About

simple word to ppt, nothing more

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages