From af28874268ec0f250a1dc5c9df80d6f68d7088fb Mon Sep 17 00:00:00 2001 From: CoderWanFeng <1957875073qq.com> Date: Sun, 21 Jun 2026 16:14:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?docs:=20=E9=87=8D=E6=9E=84=E5=B9=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=AD=E8=8B=B1=E6=96=87README=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 本次提交大幅重构了README文档,重新梳理了项目介绍、安装方式、快速体验、功能分类等内容,补充了完整的Skill体系说明、各模块详情和示例代码,同时优化了页面排版和样式,替换了旧的徽章链接,更新了文档导航和联系信息。 --- README-EN.md | 348 ++++++++++++++++++++++++++++++++------------------- README.md | 325 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 453 insertions(+), 220 deletions(-) diff --git a/README-EN.md b/README-EN.md index 39f79cb..9e4c3f9 100644 --- a/README-EN.md +++ b/README-EN.md @@ -1,191 +1,287 @@

- - github license - -

-

- 🍬python for office + + python-office +

+

- 👉 https://www.python4office.cn/ 👈 + 👉 Official Site · + Community · + Documentation · + Video Tutorials 👈

- -

- - github star +

+ + GitHub stars - - github contributors + + Gitee stars - - github forks + + PyPI Downloads - - github issues - - - github license + + Python Version + + + AI Community - - github license -

-

- - gitee star - - - gitee fork - - - -

+--- +## 📚 Introduction +**python-office** is a Python third-party library focused on **office automation**. +Every feature is just **one line of code** — automate your office work without even learning Python. +> ✨ Features are continuously updated. Submit your feature requests → [Contact the developer](https://www.python4office.cn/wechat-qrcode/) +### 🍺 Why python-office? -------------------------------------------------------------------------------- +| Feature | Description | +|---------|-------------| +| 🚀 **One-line code** | 90% of features require only a single line — zero learning curve | +| 🎯 **Scenario-driven** | Covers PDF, Word, Excel, PPT, Email, WeChat, Images, Video, and more real office tasks | +| 🧩 **Skills system** | 73 ready-to-use Skills, each independently importable | +| 🤖 **AI-friendly** | Complete `SKILL.md` + YAML metadata, directly recognizable by Codex / Claude / Cursor | +| 🛠️ **Modular** | `pip install popdf / poimage / poword ...` — install only what you need | +| 💬 **Beginner-friendly** | Full tutorials, video guides, and an active WeChat community | -[**🌎中文文档**](README.md) +--- -------------------------------------------------------------------------------- +## ✨ Skills System (73 ready-to-use Skills) -## 📚 Description +`python-office` ships with a built-in **Skill system**: the library's 73 methods are wrapped as 73 independently importable Skills, each with its own `SKILL.md` documentation. -*Python-office* is a third-party library on office automation, -which do covers its most use cases. +```python +# Option 1: Import a specific Skill +from skills.image import compress_image +compress_image(input_file='photo.jpg', output_file='photo_small.jpg', quality=30) -We are devoted to provide functionalities out-of-the-box, -allowing beginners to achieve their goals **in one line**, -without any knowledge requirements on the python language. +# Option 2: Import by category +from skills.pdf import pdf2docx +pdf2docx(input_file='report.pdf', output_file='report.docx') +``` -### 🍺 Features +### 📋 13 Categories at a Glance -- Build your office automation environments **in one command** -- Solve your problem in one line **without learning python** -- Meet your need **right on your workplace** -- Improve your efficiency **at zero cost** +| Category | Skill Count | Typical Skills | +|----------|-------------|----------------| +| 📊 Excel | 7 | `fake2excel` / `merge2excel` / `excel2pdf` | +| 📁 File | 9 | `replace4filename` / `get_files` | +| 💰 Finance | 1 | `t0` (stock T+0 return calculator) | +| 🖼️ Image | 9 | `compress_image` / `add_watermark` / `txt2wordcloud` | +| 📝 Markdown | 1 | `excel2markdown` | +| 🔍 OCR | 1 | `VatInvoiceOCR2Excel` (VAT invoice recognition) | +| 📕 PDF | 13 | `pdf2docx` / `pdf2imgs` / `merge2pdf` / `encrypt4pdf` | +| 🎬 PPT | 3 | `ppt2pdf` / `ppt2img` / `merge4ppt` | +| 🛠️ Tools | 10 | `transtools` / `qrcodetools` / `passwordtools` | +| 🎥 Video | 4 | `video2mp3` / `audio2txt` / `txt2mp3` | +| 💬 WeChat | 7 | `send_message` / `chat_robot` / `receive_message` | +| 📄 Word | 5 | `docx2pdf` / `merge4docx` / `docx4imgs` | +| 🏷️ Ruiming | 3 | `screen_unmarked_image` / `change_label_in_xml` | -------------------------------------------------------------------------------- +👉 Full index: [`skills/README.md`](./skills/README.md) -## 📦 Installation +--- -### 🍊 using pip +## 📦 Installation -```shell +```bash +# Install everything (recommended) pip install -i https://mirrors.aliyun.com/pypi/simple/ python-office -U -``` -------------------------------------------------------------------------------- +# Install only what you need (lighter) +pip install popdf # PDF processing only +pip install poimage # Image processing only +pip install poword # Word processing only +pip install poexcel # Excel processing only +``` -## 📝 Documentation +> Python version: **Python 3.7+** -[📘 Chinese Document](https://www.python4office.cn/python-office/profile/) +--- -[🎬 Video Introduction](https://space.bilibili.com/259649365/channel/collectiondetail?sid=378950) +## 🚀 5-line Quick Start -------------------------------------------------------------------------------- +```python +# 1. PDF → Word +from skills.pdf import pdf2docx +pdf2docx(input_file='report.pdf', output_file='report.docx') -## 🛠 Components +# 2. Compress an image +from skills.image import compress_image +compress_image(input_file='big.jpg', output_file='small.jpg', quality=30) -All components bellow are under construction for now. +# 3. Add a watermark to an image +from skills.image import add_watermark +add_watermark(file='photo.jpg', mark='@python-office') -| package | description | -|---------|--------------------------------------------| -| excel | excel processing | -| word | word processing | -| ppt | ppt processing | -| pdf | pdf processing | -| file | file system processing | -| tools | efficient tools | -| web | website helpers | -| email | email processing | -| image | image processing | -| video | video processing | -| ocr | character recognition & speech recognition | +# 4. Generate a word cloud +from skills.image import txt2wordcloud +txt2wordcloud(filename='article.txt', result_file='wordcloud.png') -You can import each module separately according to your requirements, -or simply `import office` to import everything (not recommended). +# 5. Generate a QR code +from skills.tools import qrcodetools +qrcodetools(url='https://www.python-office.com', output='qrcode.png') +``` -------------------------------------------------------------------------------- +--- + +## 🛠️ Components + +Each feature is accessible via the traditional `import office` style, or directly from `skills.xxx`. + +| Module | Description | Skills Path | +|--------|-------------|-------------| +| PyOfficeRobot | WeChat bot | `skills/wechat/` | +| poocr | OCR (invoice, table, image) | `skills/ocr/` | +| popdf | PDF → Word / image / split / merge / encrypt | `skills/pdf/` | +| poemail | Auto-send emails | `office/api/email.py` | +| porobot | AI bot | `office/api/tools.py` | +| poimage | Image compress / watermark / word cloud / filters | `skills/image/` | +| poai | AI utilities | `office/lib/` | +| poexcel | Excel merge / split / mock data | `skills/excel/` | +| poword | Word → PDF / extract images | `skills/word/` | +| pofile | Batch file rename / organize | `skills/file/` | +| search4file | Document search | `skills/file/` | +| poppt | PPT → PDF / image | `skills/ppt/` | +| wftools | Translation / QR code / password generator, etc. | `skills/tools/` | +| pofinance | Stock T+0 calculator | `skills/finance/` | +| pohan | Chinese programming | - | +| povideo | Video → audio / speech recognition | `skills/video/` | +| potime | Time utilities | - | +| poprogress | Progress bar utilities | - | +| pocode | Code management | - | + +--- + +## 💡 Featured Skills + +
+📊 Excel Processing (click to expand) + +```python +from skills.excel import fake2excel +fake2excel(columns=['name', 'phone'], rows=1000, path='test.xlsx') + +from skills.excel import merge2excel +merge2excel(dir_path='./my_excels', output_file='all.xlsx') +``` +
+ +
+📕 PDF Processing (click to expand) + +```python +from skills.pdf import pdf2docx # PDF → Word +from skills.pdf import pdf2imgs # PDF → images +from skills.pdf import merge2pdf # Merge multiple PDFs +from skills.pdf import split4pdf # Split a PDF +from skills.pdf import encrypt4pdf # Encrypt a PDF +from skills.pdf import add_watermark_by_parameters # PDF watermark +``` +
+ +
+🖼️ Image Processing (click to expand) + +```python +from skills.image import compress_image # Compress images +from skills.image import add_watermark # Add watermark +from skills.image import del_watermark # Remove watermark +from skills.image import txt2wordcloud # Generate word cloud +from skills.image import pencil4img # Pencil-sketch style +from skills.image import img2Cartoon # Cartoon style +from skills.image import decode_qrcode # Decode QR code +``` +
-## 🏗 How to contribute +
+💬 WeChat Bot (click to expand) -### 📐 Specifications +```python +from skills.wechat import send_message +send_message(who='File Transfer', message='Hello!') -You are welcome to commit your code, following the specifications below: +from skills.wechat import send_message_by_time +send_message_by_time(who='File Transfer', message='Good morning', time='08:00:00') +``` +
-Steps to participate in developing +
+🎬 Video Processing (click to expand) -- For example, you ought to add a `add` function - 1. your GitHub account is *demo* - 2. you create the **demo** directory in `./contributors` - 3. new `add.py`, in which you write your code - 4. finish editing, you commit a PR to the `master` branch (no matter on GitHub or gitee) with your naming proposal - 5. @CoderWanFeng receive it, test it, merge it and finally upload it to PyPI 🎉 +```python +from skills.video import video2mp3 # Video → MP3 +from skills.video import audio2txt # Audio → text +from skills.video import txt2mp3 # Text → speech +from skills.video import mark2video # Video watermark +``` +
-### 📐 Code style +--- -1. **Annotation.** you should explain each parameter and returns of every new function. - Unit test is alternative. You are allowed to sign it. -2. **Formatting.** Note that you can only format *your* own code. -3. Please pull request to `master` branch directly, which stands for the published version on PyPI. - *(This may change when contributors increase in the future)* -4. If we close your issue/PR, ease it. This is our way to keep it clean. - You can still discuss it, and we would reopen it when there exists an acknowledged solution. +## 📝 Documentation -### 🧬Steps to contribute +- 📘 [Chinese Documentation](https://github.com/CoderWanFeng/python-office/tree/develop/.qoder/repowiki/zh/content) +- 📗 [English Documentation](https://github.com/CoderWanFeng/python-office/tree/develop/.qoder/repowiki/en/content) +- 🎬 [Video Tutorials](https://www.python-office.com/video/video.html) +- 🤖 [Skills Index](./skills/README.md) -1. **fork** this repo (on GitHub or gitee) -2. **clone** it to your local file system -3. **modify** your code -4. **commit & push** your changes to the remote repo -5. **pull request** to the `master` branch after logging in to GitHub/gitee and fill some information -6. **wait** for maintainers merging it +--- -### 🎋 Instructions on the branches +## 🤝 Contributing -This Repository contains 2 branches, listing as follows: +Contributions are welcome. Please submit your PR in a dedicated folder: -| branch | functionality | -|-----------|-----------------------------------------------------| -| `master` | main branch, published on PyPI, you should PR here | -| `develop` | development branch, ~~idling in fact~~ | +- Create a folder with your GitHub username under [contributors](./contributors/) +- Put all your code inside that folder +- **Do not modify any other folders** +- For questions about existing code, please open an issue -### 🐞 Provide bug feedback or suggestions +### Code Style -Please ensure the relationship to this repo. -Other issue (such as learning python) is not allowed. +1. **Comments**: Document every parameter and return value of new functions +2. **Formatting**: Format only your own code +3. **Tests**: Unit tests are optional but strongly recommended +4. **Skills**: When adding a new method, also add a Skill wrapper under `skills///` -- [gitee issue](https://gitee.com/CoderWanFeng/python-office/issues) -- [GitHub issue](https://github.com/CoderWanFeng/python-office/issues) +--- -------------------------------------------------------------------------------- +## 🐞 Bug Reports & Suggestions -## 🪙 Support us +Please only submit issues related to the python-office codebase itself. We don't answer general Python learning questions. -### 💳 Donation +- [GitHub Issues](https://github.com/CoderWanFeng/python-office/issues) +- [Gitee Issues](https://gitee.com/CoderWanFeng/python-office/issues) +- [AtomGit Issues](https://atomgit.com/CoderWanFeng1/python-office/issues) -Buy us a cup of coffee if you appreciate python-office. Thank you sincerely. +--- -[donate to this project](https://gitee.com/CoderWanFeng/python-office) -👈 the donation will be used to support the development of this project +## ⭐ Star History -[donate to @CoderWanFeng](https://www.python4office.cn/wechat-qrcode/) +[![Stargazers over time](https://starchart.cc/CoderWanFeng/python-office.svg)](https://starchart.cc/CoderWanFeng/python-office) +--- -------------------------------------------------------------------------------- +## 📌 Contact the Author -## ⭐Star python-office +

+ + + +

-[![Stargazers over time](https://starchart.cc/CoderWanFeng/python-office.svg)](https://starchart.cc/CoderWanFeng/python-office) +

+ 👉 Join the open-source community · + WeChat the author 👈 +

-## 📌 WeChat official & our open source group +--- -
- - -
\ No newline at end of file +

+ If this project helps you, a ⭐ Star is the best encouragement! +

diff --git a/README.md b/README.md index 20e7064..f4f2815 100644 --- a/README.md +++ b/README.md @@ -1,151 +1,288 @@ -

- github license - + python-office +

+

- 👉 项目官网:https://www.python-office.com/ 👈 + 👉 项目官网 · + 交流群 · + 中文文档 · + 视频教程 👈

+

- 👉 本开源项目的交流群 👈 + + GitHub stars + + + Gitee stars + + + PyPI Downloads + + + Python Version + + + AI交流群 +

+--- +## 📚 简介 -

- - github star - - - gitee star - - - atomgit star - - -PyPI Downloads - - - AI编程 - - - AI交流群 - +**python-office** 是一个专注于**办公自动化**的 Python 第三方库。 +每个功能只需 **一行代码** 即可完成,让你不学 Python 也能自动化办公。 -

+> ✨ 功能持续更新中,欢迎提交你的功能需求 → [开发者微信](https://www.python4office.cn/wechat-qrcode/) +### 🍺 为什么选择 python-office? +| 特点 | 说明 | +|------|------| +| 🚀 **一行代码** | 90% 的功能只需要一行代码,零基础也能用 | +| 🎯 **场景驱动** | 覆盖 PDF、Word、Excel、PPT、邮件、微信、图片、视频等真实办公场景 | +| 🧩 **Skills 体系** | 内置 73 个开箱即用的 Skill,每个 Skill 独立可调用 | +| 🤖 **AI 友好** | 完整 `SKILL.md` + YAML 描述,可被 Codex / Claude / Cursor 等 AI 直接识别 | +| 🛠️ **可拆可合** | 按需 `pip install popdf / poimage / poword ...`,不冗余 | +| 💬 **中文友好** | 全中文文档、视频教程、微信答疑群 | +--- +## ✨ Skills 体系(73 个开箱即用) +`python-office` 内置了一套 **Skill 体系**:把库里的 73 个方法封装成 73 个独立可调用的 Skill, +每个 Skill 有自己的 `SKILL.md` 文档,可以单独 import,也可以整体使用。 +```bash +# 方式 1:直接调用具体 Skill +from skills.image import compress_image +compress_image(input_file='photo.jpg', output_file='photo_small.jpg', quality=30) +# 方式 2:按分类批量导入 +from skills.pdf import pdf2docx +pdf2docx(input_file='report.pdf', output_file='report.docx') +``` -------------------------------------------------------------------------------- +### 📋 13 个分类速查表 -## 📚简介 +| 分类 | Skill 数量 | 典型 Skill | +|------|----------|-----------| +| 📊 Excel | 7 | `fake2excel` / `merge2excel` / `excel2pdf` | +| 📁 File | 9 | `replace4filename` / `get_files` | +| 💰 Finance | 1 | `t0`(股票做 T 收益计算)| +| 🖼️ Image | 9 | `compress_image` / `add_watermark` / `txt2wordcloud` | +| 📝 Markdown | 1 | `excel2markdown` | +| 🔍 OCR | 1 | `VatInvoiceOCR2Excel`(增值税发票识别)| +| 📕 PDF | 13 | `pdf2docx` / `pdf2imgs` / `merge2pdf` / `encrypt4pdf` | +| 🎬 PPT | 3 | `ppt2pdf` / `ppt2img` / `merge4ppt` | +| 🛠️ Tools | 10 | `transtools` / `qrcodetools` / `passwordtools` | +| 🎥 Video | 4 | `video2mp3` / `audio2txt` / `txt2mp3` | +| 💬 WeChat | 7 | `send_message` / `chat_robot` / `receive_message` | +| 📄 Word | 5 | `docx2pdf` / `merge4docx` / `docx4imgs` | +| �️ Ruiming | 3 | `screen_unmarked_image` / `change_label_in_xml` | -Python-office 是一个 Python 自动化办公第三方库,能解决大部分自动化办公的问题。而且每个功能只需一行代码,不需要小白用户学习 -Python 知识,做到了真正的开箱即用。 -> 功能持续更新中,提交你的功能需求/参与项目开发,联系👉[开发者微信](https://www.python4office.cn/wechat-qrcode/) +👉 查看完整 Skill 索引:[`skills/README.md`](./skills/README.md) -

- - - -

+--- -### 🍺特点 +## 📦 安装 -- 一键搭建所有 Python + 自动化办公的编程环境。 -- 使用一行代码解决大部分自动化办公的问题,不需要小白学习 Python 知识 -- 贴合职场办公需求 -- 极简编程,学习成本极低,工作效率提升显著 +```bash +# 一键安装(推荐) +pip install -i https://mirrors.aliyun.com/pypi/simple/ python-office -U -------------------------------------------------------------------------------- +# 按需安装子库(更轻量) +pip install popdf # 只用 PDF 处理 +pip install poimage # 只用图片处理 +pip install poword # 只用 Word 处理 +pip install poexcel # 只用 Excel 处理 +``` -## 📦安装 +> Python 版本要求:**Python 3.7+** -### 🍊pip 自动下载&更新 +--- -``` -pip install -i https://mirrors.aliyun.com/pypi/simple/ python-office -U -``` +## � 5 行代码快速体验 + +```python +# 1. PDF 转 Word +from skills.pdf import pdf2docx +pdf2docx(input_file='report.pdf', output_file='report.docx') -------------------------------------------------------------------------------- +# 2. 批量压缩图片 +from skills.image import compress_image +compress_image(input_file='big.jpg', output_file='small.jpg', quality=30) -## 📝文档 +# 3. 给图片加水印 +from skills.image import add_watermark +add_watermark(file='photo.jpg', mark='@python-office') +# 4. 文本生成词云 +from skills.image import txt2wordcloud +txt2wordcloud(filename='article.txt', result_file='wordcloud.png') -- [中文文档](https://github.com/CoderWanFeng/python-office/tree/develop/.qoder/repowiki/zh/content) -- [English Document](https://github.com/CoderWanFeng/python-office/tree/develop/.qoder/repowiki/en/content) -- [视频教程](https://www.python-office.com/video/video.html) +# 5. 生成二维码 +from skills.tools import qrcodetools +qrcodetools(url='https://www.python-office.com', output='qrcode.png') +``` + +--- + +## 🛠️ 功能分类 + +每个功能既支持传统的 `import office` 方式,也支持从 `skills.xxx` 单独调用。 + +| 模块 | 功能 | Skills 路径 | +|------|------|-------------| +| PyOfficeRobot | 微信机器人 | `skills/wechat/` | +| poocr | 文字识别(发票、表格、图片)| `skills/ocr/` | +| popdf | PDF 转 Word / 图片 / 拆分 / 合并 / 加密 | `skills/pdf/` | +| poemail | 自动发邮件 | `office/api/email.py` | +| porobot | AI 机器人 | `office/api/tools.py` | +| poimage | 图片压缩 / 水印 / 词云 / 滤镜 | `skills/image/` | +| poai | AI 工具集 | `office/lib/` | +| poexcel | Excel 合并 / 拆分 / 模拟数据 | `skills/excel/` | +| poword | Word 转 PDF / 提取图片 | `skills/word/` | +| pofile | 文件批量重命名 / 整理 | `skills/file/` | +| search4file | 文档搜索 | `skills/file/` | +| poppt | PPT 转 PDF / 图片 | `skills/ppt/` | +| wftools | 翻译 / 二维码 / 密码生成等小工具 | `skills/tools/` | +| pofinance | 股票做 T 计算 | `skills/finance/` | +| pohan | 中文编程 | - | +| povideo | 视频转音频 / 语音识别 | `skills/video/` | +| potime | 时间工具 | - | +| poprogress | 进度条工具 | - | +| pocode | 代码管理 | - | + +--- + +## 💡 精选 Skill 一览 + +
+📊 Excel 处理(点击展开) + +```python +from skills.excel import fake2excel +fake2excel(columns=['name', 'phone'], rows=1000, path='test.xlsx') + +from skills.excel import merge2excel +merge2excel(dir_path='./my_excels', output_file='all.xlsx') +``` +
+ +
+📕 PDF 处理(点击展开) + +```python +from skills.pdf import pdf2docx # PDF → Word +from skills.pdf import pdf2imgs # PDF → 图片 +from skills.pdf import merge2pdf # 合并多个 PDF +from skills.pdf import split4pdf # 拆分 PDF +from skills.pdf import encrypt4pdf # 加密 PDF +from skills.pdf import add_watermark_by_parameters # PDF 加水印 +``` +
+ +
+🖼️ Image 图像处理(点击展开) + +```python +from skills.image import compress_image # 压缩图片 +from skills.image import add_watermark # 加水印 +from skills.image import del_watermark # 去水印 +from skills.image import txt2wordcloud # 生成词云 +from skills.image import pencil4img # 转铅笔画 +from skills.image import img2Cartoon # 转卡通风格 +from skills.image import decode_qrcode # 解析二维码 +``` +
+
+💬 微信机器人(点击展开) -## 🛠️包含组件 +```python +from skills.wechat import send_message +send_message(who='文件传输助手', message='Hello!') -很多朋友发现``python-office``这个库,下载很慢很大,是因为它集成了以下这些库,你可以去挑自己需要功能,单独下载对应的第三方库。 -> 以下所有独立的子库,也都在持续地开发和维护中。 +from skills.wechat import send_message_by_time +send_message_by_time(who='文件传输助手', message='早安', time='08:00:00') +``` +
-| 模块 | 介绍 | -|---------------|--------------| -| PyOfficeRobot | 微信机器人 | -| poocr | 识别功能,例如:发票识别 | -| popdf | pdf处理 | -| poemail | 自动发邮件 | -| porobot | AI机器人 | -| poimage | 图片处理 | -| poai | AI工具 | -| poexcel | excel处理 | -| poword | word处理 | -| pofile | 文件管理 | -| search4file | 文档搜索 | -| poppt | ppt处理 | -| wftools | 便捷小工具 | -| pofinance | 炒股工具 | -| pohan | 中文编程 | -| povideo | 视频处理 | -| potime | 时间工具 | -| poprogress | 进度条工具 | -| pocode | 代码管理 | +
+🎬 Video 视频处理(点击展开) +```python +from skills.video import video2mp3 # 视频 → MP3 +from skills.video import audio2txt # 音频 → 文字 +from skills.video import txt2mp3 # 文字 → 语音 +from skills.video import mark2video # 视频加文字水印 +``` +
-可以根据需求对每个模块单独引入,也可以通过`import office`方式引入所有模块。 +--- +## 📝 文档 -------------------------------------------------------------------------------- +- � [中文文档](https://github.com/CoderWanFeng/python-office/tree/develop/.qoder/repowiki/zh/content) +- 📗 [English Document](https://github.com/CoderWanFeng/python-office/tree/develop/.qoder/repowiki/en/content) +- 🎬 [视频教程](https://www.python-office.com/video/video.html) +- 🤖 [Skills 索引](./skills/README.md) -## 🏗️添砖加瓦 +--- -### 📐PR的建议 +## 🤝 贡献代码 -python-office欢迎任何人来添砖加瓦,贡献代码,建议提交的pr(pull request)放在一个单独的文件夹下: +python-office 欢迎任何人来添砖加瓦。建议提交的 PR 放在一个独立的文件夹下: -- 在[contributors](https://atomgit.com/CoderWanFeng1/python-office/tree/main/contributors)文件夹中,用自己的GitHub名字建一个文件夹; +- 在 [contributors](./contributors/) 文件夹中,用自己的 GitHub 名字建一个文件夹; - 把自己的所有代码,都提交到这个自己的文件夹里; -- 不要改其它任何文件夹里的代码!不要改别人的代码! -- 对别人的代码有疑问,可以直接提issue。 +- **不要修改其它任何文件夹下的代码**; +- 对现有代码有疑问,可以直接提 issue。 + +### 代码风格 + +1. **注释**:请为每个新函数的参数、返回值添加说明 +2. **格式**:只能格式化自己写的代码 +3. **测试**:单元测试可选,但强烈推荐 +4. **Skill**:新增方法时,建议同时在 `skills/<分类>/<方法名>/` 下加 Skill 封装 + +--- -### 🐞提供bug反馈或建议 +## 🐞 提供 Bug 反馈或建议 -提交问题反馈时,请务必填写和python-office代码本身有关的问题,不进行有关python学习,甚至是个人练习的知识答疑和讨论。 +提交问题反馈时,请务必填写和 python-office 代码本身有关的问题,不进行 Python 学习或个人练习的答疑。 -- [atomgit issue](https://atomgit.com/CoderWanFeng1/python-office/issues) -- [Gitee issue](https://gitee.com/CoderWanFeng/python-office/issues) -- [Github issue](https://github.com/CoderWanFeng/python-office/issues) +- [GitHub Issue](https://github.com/CoderWanFeng/python-office/issues) +- [Gitee Issue](https://gitee.com/CoderWanFeng/python-office/issues) +- [AtomGit Issue](https://atomgit.com/CoderWanFeng1/python-office/issues) -------------------------------------------------------------------------------- +--- -## ⭐Star python-office +## ⭐ Star History [![Stargazers over time](https://starchart.cc/CoderWanFeng/python-office.svg)](https://starchart.cc/CoderWanFeng/python-office) -## 📌联系作者 +--- -

+## 📌 联系作者 + +

- - + +

+

+ 👉 加入开源交流群 · + 联系作者微信 👈 +

+ +--- + +

+ 如果这个项目对你有帮助,欢迎 ⭐ Star 支持一下! +

From 839b9c1282a74a37705c9b4e6999594268fcc9c5 Mon Sep 17 00:00:00 2001 From: CoderWanFeng <1957875073qq.com> Date: Sun, 21 Jun 2026 17:19:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20=E9=87=8D=E6=9E=84=E9=A1=B9?= =?UTF-8?q?=E7=9B=AEREADME=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 删除旧的英文README-EN.md,将主README.md改为英文版本并新增中文README-CN.md 2. 统一文档结构,新增TL;DR、快速导航、使用场景、路线图等章节 3. 优化内容排版与翻译,统一使用英文术语规范 4. 补充徽章信息与演示示例区域 --- README-CN.md | 422 +++++++++++++++++++++++++++++++++++++++++++++++++++ README-EN.md | 287 ----------------------------------- README.md | 406 ++++++++++++++++++++++++++++++++----------------- 3 files changed, 690 insertions(+), 425 deletions(-) create mode 100644 README-CN.md delete mode 100644 README-EN.md diff --git a/README-CN.md b/README-CN.md new file mode 100644 index 0000000..75bf9af --- /dev/null +++ b/README-CN.md @@ -0,0 +1,422 @@ +

+ English · + 中文文档 · + 中文 +

+ +

+ + python-office + +

+ +

python-office

+ +

+ 🚀 一行代码,搞定办公自动化 +
+ 73 个开箱即用的 Skills,覆盖 PDF、Word、Excel、PPT、邮件、微信、图片、视频等全场景 +

+ +

+ + PyPI + Downloads + Total Downloads + + GitHub stars + Gitee stars + + License + Python + Build + Windows + + WeChat + Video +

+ +--- + +## ⚡ TL;DR + +> **python-office** 是中文世界最受欢迎的 Python 办公自动化库。 +> 一个库解决 90% 办公场景:**PDF/Word/Excel/PPT 转换、图片处理、视频音频、微信机器人、邮件、文件管理、OCR、AI 工具**…… +> 零基础也能上手——**所有功能只需一行代码**。 + +```python +pip install python-office +``` + +```python +import office # 一行导入,所有功能立刻可用 +``` + +--- + +## ✨ Key Features + +| | 功能 | +|---|---| +| 🎯 **一行代码** | 90% 的功能只需 `office.模块.方法()`,零学习成本 | +| 🧩 **73 个 Skills** | 每个功能独立可调,按需使用,不冗余 | +| 🤖 **AI 友好** | 每个 Skill 都有 `SKILL.md` + YAML 描述,Codex/Claude/Cursor 可直接识别 | +| 🌏 **中文优先** | 全中文文档、视频教程、微信答疑群 | +| 🪶 **轻量灵活** | 不需要的功能可以不安装:`pip install popdf` / `poimage` / `poword` | +| 🔄 **持续更新** | 2020 起持续维护,73+ 功能仍在迭代 | +| 📦 **一次安装** | `import office` 即引入全部能力;不想要也可单独 import | +| 🛡️ **稳定可靠** | 已被数千个项目使用,MIT 开源 | + +--- + +## 📸 Demo + +> 🚧 **展示区** —— 你可以替换为你自己的截图或 GIF 动图 + +| 图片处理 | PDF 处理 | 微信机器人 | +|:---:|:---:|:---:| +| 水印 / 词云 / 铅笔画 | 转 Word / 合并 / 加密 | 群发 / 智能聊天 | +| ![demo-image](https://placehold.co/280x180/4A90E2/fff?text=Image+Skills) | ![demo-pdf](https://placehold.co/280x180/50C878/fff?text=PDF+Skills) | ![demo-wechat](https://placehold.co/280x180/E74C3C/fff?text=WeChat+Skills) | + +| Excel 处理 | PPT 处理 | 视频/音频 | +|:---:|:---:|:---:| +| 模拟数据 / 合并 / 拆分 | 转 PDF / 转图 | 提取音频 / 字幕 | +| ![demo-excel](https://placehold.co/280x180/F39C12/fff?text=Excel+Skills) | ![demo-ppt](https://placehold.co/280x180/9B59B6/fff?text=PPT+Skills) | ![demo-video](https://placehold.co/280x180/1ABC9C/fff?text=Video+Skills) | + +--- + +## 🧭 快速跳转 + +| 想做什么? | 跳到 | +|----------|------| +| 第一次使用 | [📦 安装](#-安装) | +| 看 5 个例子感受一下 | [🚀 Quick Start](#-quick-start5-行代码体验) | +| 找具体功能 | [🛠️ 功能分类](#%EF%B8%8F-功能分类) 或 [`skills/README.md`](./skills/README.md) | +| 了解 Skill 体系 | [✨ Skills 体系](#-skills-体系73-个开箱即用) | +| 加群提问 | [💬 联系作者](#-联系作者) | +| 给项目贡献代码 | [🤝 贡献](#-贡献代码) | + +--- + +## 🧩 Skills 体系(73 个开箱即用) + +`python-office` 内置了一套 **Skill 体系**:把库里的 73 个方法封装成 73 个独立可调用的 Skill,每个 Skill 有自己的 `SKILL.md` 文档,可以单独 import,也可以整体使用。 + +> 💡 **为什么是 Skill?** 借助 Skill,Codex、Claude、Cursor 等 AI 工具可以**自动识别**你的需求并调用对应功能。 + +```python +# 方式 1:直接调用具体 Skill +from skills.image import compress_image +compress_image(input_file='photo.jpg', output_file='photo_small.jpg', quality=30) + +# 方式 2:按分类批量导入 +from skills.pdf import pdf2docx +pdf2docx(input_file='report.pdf', output_file='report.docx') + +# 方式 3:原始的 office 方式(兼容) +import office +office.image.compress_image(input_file='photo.jpg', output_file='photo_small.jpg', quality=30) +``` + +### 📋 13 个分类速查表 + +| 分类 | Skill 数 | 典型 Skill | +|------|--------|-----------| +| 📊 Excel | 7 | `fake2excel` / `merge2excel` / `excel2pdf` | +| 📁 File | 9 | `replace4filename` / `get_files` | +| 💰 Finance | 1 | `t0`(股票做 T 收益计算)| +| 🖼️ Image | 9 | `compress_image` / `add_watermark` / `txt2wordcloud` | +| 📝 Markdown | 1 | `excel2markdown` | +| 🔍 OCR | 1 | `VatInvoiceOCR2Excel`(增值税发票识别)| +| 📕 PDF | 13 | `pdf2docx` / `pdf2imgs` / `merge2pdf` / `encrypt4pdf` | +| 🎬 PPT | 3 | `ppt2pdf` / `ppt2img` / `merge4ppt` | +| 🛠️ Tools | 10 | `transtools` / `qrcodetools` / `passwordtools` | +| 🎥 Video | 4 | `video2mp3` / `audio2txt` / `txt2mp3` | +| 💬 WeChat | 7 | `send_message` / `chat_robot` / `receive_message` | +| 📄 Word | 5 | `docx2pdf` / `merge4docx` / `docx4imgs` | +| 🏷️ Ruiming | 3 | `screen_unmarked_image` / `change_label_in_xml` | + +👉 查看完整 Skill 索引:[`skills/README.md`](./skills/README.md) + +--- + +## 📦 安装 + +```bash +# 一键安装(推荐) +pip install -i https://mirrors.aliyun.com/pypi/simple/ python-office -U + +# 按需安装子库(更轻量) +pip install popdf # 只用 PDF 处理 +pip install poimage # 只用图片处理 +pip install poword # 只用 Word 处理 +pip install poexcel # 只用 Excel 处理 +``` + +> **Python 版本要求**:Python 3.7+ +> **安装问题**:[📝 常见问题与故障排除](https://www.python4office.cn/python-office/profile/) + +--- + +## 🚀 Quick Start(5 行代码体验) + +```python +# 1. PDF 转 Word +from skills.pdf import pdf2docx +pdf2docx(input_file='report.pdf', output_file='report.docx') + +# 2. 批量压缩图片 +from skills.image import compress_image +compress_image(input_file='big.jpg', output_file='small.jpg', quality=30) + +# 3. 给图片加水印 +from skills.image import add_watermark +add_watermark(file='photo.jpg', mark='@python-office') + +# 4. 文本生成词云 +from skills.image import txt2wordcloud +txt2wordcloud(filename='article.txt', result_file='wordcloud.png') + +# 5. 生成二维码 +from skills.tools import qrcodetools +qrcodetools(url='https://www.python-office.com', output='qrcode.png') +``` + +> 🎬 视频教程: + +--- + +## 💡 精选 Skill 一览 + +
+📊 Excel 处理(点击展开) + +```python +from skills.excel import fake2excel +fake2excel(columns=['name', 'phone'], rows=1000, path='test.xlsx') + +from skills.excel import merge2excel +merge2excel(dir_path='./my_excels', output_file='all.xlsx') +``` +
+ +
+📕 PDF 处理(点击展开) + +```python +from skills.pdf import pdf2docx # PDF → Word +from skills.pdf import pdf2imgs # PDF → 图片 +from skills.pdf import merge2pdf # 合并多个 PDF +from skills.pdf import split4pdf # 拆分 PDF +from skills.pdf import encrypt4pdf # 加密 PDF +from skills.pdf import add_watermark_by_parameters # PDF 加水印 +``` +
+ +
+🖼️ Image 图像处理(点击展开) + +```python +from skills.image import compress_image # 压缩图片 +from skills.image import add_watermark # 加水印 +from skills.image import del_watermark # 去水印 +from skills.image import txt2wordcloud # 生成词云 +from skills.image import pencil4img # 转铅笔画 +from skills.image import img2Cartoon # 转卡通风格 +from skills.image import decode_qrcode # 解析二维码 +``` +
+ +
+💬 微信机器人(点击展开) + +```python +from skills.wechat import send_message +send_message(who='文件传输助手', message='Hello!') + +from skills.wechat import send_message_by_time +send_message_by_time(who='文件传输助手', message='早安', time='08:00:00') +``` +
+ +
+🎬 Video 视频处理(点击展开) + +```python +from skills.video import video2mp3 # 视频 → MP3 +from skills.video import audio2txt # 音频 → 文字 +from skills.video import txt2mp3 # 文字 → 语音 +from skills.video import mark2video # 视频加文字水印 +``` +
+ +--- + +## 🌟 适用场景 + +python-office 适用于以下人群和场景: + +| 👤 人群 | 🎯 场景 | +|--------|--------| +| 📊 **职场白领** | 批量处理 PDF、Excel、Word、PPT,提高 10x 效率 | +| 🎓 **学生 / 教师** | 论文排版、试卷批改、资料整理 | +| 👨‍💻 **开发者** | 自动化脚本、爬虫数据处理、文件批处理 | +| 🤖 **AI 玩家** | 让 AI 自动调用工具完成复杂办公任务 | +| 📷 **运营 / 自媒体** | 图片批量处理、视频转音频、生成二维码 | +| 💼 **财务 / HR** | 发票 OCR、Excel 合并、文件整理 | + +--- + +## 🛠️ 功能分类 + +每个功能既支持传统的 `import office` 方式,也支持从 `skills.xxx` 单独调用。 + +| 模块 | 功能 | Skills 路径 | +|------|------|-------------| +| PyOfficeRobot | 微信机器人 | `skills/wechat/` | +| poocr | 文字识别(发票、表格、图片)| `skills/ocr/` | +| popdf | PDF 转 Word / 图片 / 拆分 / 合并 / 加密 | `skills/pdf/` | +| poemail | 自动发邮件 | `office/api/email.py` | +| porobot | AI 机器人 | `office/api/tools.py` | +| poimage | 图片压缩 / 水印 / 词云 / 滤镜 | `skills/image/` | +| poai | AI 工具集 | `office/lib/` | +| poexcel | Excel 合并 / 拆分 / 模拟数据 | `skills/excel/` | +| poword | Word 转 PDF / 提取图片 | `skills/word/` | +| pofile | 文件批量重命名 / 整理 | `skills/file/` | +| search4file | 文档搜索 | `skills/file/` | +| poppt | PPT 转 PDF / 图片 | `skills/ppt/` | +| wftools | 翻译 / 二维码 / 密码生成等小工具 | `skills/tools/` | +| pofinance | 股票做 T 计算 | `skills/finance/` | +| pohan | 中文编程 | - | +| povideo | 视频转音频 / 语音识别 | `skills/video/` | +| potime | 时间工具 | - | +| poprogress | 进度条工具 | - | +| pocode | 代码管理 | - | + +--- + +## 🗺️ 路线图 + +- [x] **v1.x**:73 个 Skill,覆盖办公自动化全场景 +- [x] **Skills 体系**:每个功能可独立 AI 调用 +- [ ] **v2.0**:插件化架构,支持自定义 Skill +- [ ] **Web GUI**:可视化操作界面 +- [ ] **更多 AI 能力**:AI 写作、AI 数据分析 +- [ ] **企业版**:私有部署 + 权限管理 + +欢迎在 [Issues](https://github.com/CoderWanFeng/python-office/issues) 中提需求! + +--- + +## 📝 文档 + +- 📘 [中文文档](https://www.python4office.cn/python-office/profile/) +- 📗 [English Document](https://www.python4office.cn/python-office/profile/) +- 🎬 [视频教程合集](https://www.python-office.com/video/video.html) +- 🤖 [Skills 索引](./skills/README.md) +- ❓ [常见问题 FAQ](https://www.python4office.cn/python-office/profile/) + +--- + +## 🤝 贡献代码 + +python-office 欢迎任何人来添砖加瓦。建议提交的 PR 放在一个独立的文件夹下: + +- 在 [contributors](./contributors/) 文件夹中,用自己的 GitHub 名字建一个文件夹; +- 把自己的所有代码,都提交到这个自己的文件夹里; +- **不要修改其它任何文件夹下的代码**; +- 对现有代码有疑问,可以直接提 issue。 + +### 代码风格 + +1. **注释**:请为每个新函数的参数、返回值添加说明 +2. **格式**:只能格式化自己写的代码 +3. **测试**:单元测试可选,但强烈推荐 +4. **Skill**:新增方法时,建议同时在 `skills/<分类>/<方法名>/` 下加 Skill 封装 + +### 贡献者 ✨ + +感谢所有让 python-office 变得更好的朋友们! + + + + + +--- + +## 🐞 提供 Bug 反馈或建议 + +提交问题反馈时,请务必填写和 python-office 代码本身有关的问题,不进行 Python 学习或个人练习的答疑。 + +- [GitHub Issue](https://github.com/CoderWanFeng/python-office/issues) +- [Gitee Issue](https://gitee.com/CoderWanFeng/python-office/issues) +- [AtomGit Issue](https://atomgit.com/CoderWanFeng1/python-office/issues) + +--- + +## 💖 赞助 / Sponsor + +如果 python-office 帮你节省了大量时间,欢迎支持我们持续维护: + +- ⭐ **Star 本项目** —— 这是最大的支持 +- 🗣️ **向朋友推荐** —— 口碑传播 +- 💰 **微信赞赏** —— 二维码见文档底部 +- 🐛 **贡献代码** —— 提交 PR 或 Issue + +--- + +## 📜 License + +本项目使用 [MIT License](https://opensource.org/licenses/MIT) 开源。 + +``` +MIT License + +Copyright (c) 2026 CoderWanFeng + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +``` + +--- + +## 🙏 致谢 + +- 感谢所有贡献者、提 Issue 的用户 +- 感谢 [python4office](https://www.python4office.cn/) 社区的支持 +- 灵感来自 [Requests](https://github.com/psf/requests)、[FastAPI](https://github.com/tiangolo/fastapi)、[LangChain](https://github.com/langchain-ai/langchain) 等优秀开源项目 +- Built with ❤️ in China + +--- + +## ⭐ Star History + +[![Stargazers over time](https://starchart.cc/CoderWanFeng/python-office.svg)](https://starchart.cc/CoderWanFeng/python-office) + +--- + +## 📌 联系作者 + +

+ + + +

+ +

+ 👉 加入开源交流群 · + 联系作者微信 👈 +

+ +--- + +

+ 如果这个项目对你有帮助,欢迎 ⭐ Star 支持一下! +

diff --git a/README-EN.md b/README-EN.md deleted file mode 100644 index 9e4c3f9..0000000 --- a/README-EN.md +++ /dev/null @@ -1,287 +0,0 @@ -

- - python-office - -

- -

- 👉 Official Site · - Community · - Documentation · - Video Tutorials 👈 -

- -

- - GitHub stars - - - Gitee stars - - - PyPI Downloads - - - Python Version - - - AI Community - -

- ---- - -## 📚 Introduction - -**python-office** is a Python third-party library focused on **office automation**. -Every feature is just **one line of code** — automate your office work without even learning Python. - -> ✨ Features are continuously updated. Submit your feature requests → [Contact the developer](https://www.python4office.cn/wechat-qrcode/) - -### 🍺 Why python-office? - -| Feature | Description | -|---------|-------------| -| 🚀 **One-line code** | 90% of features require only a single line — zero learning curve | -| 🎯 **Scenario-driven** | Covers PDF, Word, Excel, PPT, Email, WeChat, Images, Video, and more real office tasks | -| 🧩 **Skills system** | 73 ready-to-use Skills, each independently importable | -| 🤖 **AI-friendly** | Complete `SKILL.md` + YAML metadata, directly recognizable by Codex / Claude / Cursor | -| 🛠️ **Modular** | `pip install popdf / poimage / poword ...` — install only what you need | -| 💬 **Beginner-friendly** | Full tutorials, video guides, and an active WeChat community | - ---- - -## ✨ Skills System (73 ready-to-use Skills) - -`python-office` ships with a built-in **Skill system**: the library's 73 methods are wrapped as 73 independently importable Skills, each with its own `SKILL.md` documentation. - -```python -# Option 1: Import a specific Skill -from skills.image import compress_image -compress_image(input_file='photo.jpg', output_file='photo_small.jpg', quality=30) - -# Option 2: Import by category -from skills.pdf import pdf2docx -pdf2docx(input_file='report.pdf', output_file='report.docx') -``` - -### 📋 13 Categories at a Glance - -| Category | Skill Count | Typical Skills | -|----------|-------------|----------------| -| 📊 Excel | 7 | `fake2excel` / `merge2excel` / `excel2pdf` | -| 📁 File | 9 | `replace4filename` / `get_files` | -| 💰 Finance | 1 | `t0` (stock T+0 return calculator) | -| 🖼️ Image | 9 | `compress_image` / `add_watermark` / `txt2wordcloud` | -| 📝 Markdown | 1 | `excel2markdown` | -| 🔍 OCR | 1 | `VatInvoiceOCR2Excel` (VAT invoice recognition) | -| 📕 PDF | 13 | `pdf2docx` / `pdf2imgs` / `merge2pdf` / `encrypt4pdf` | -| 🎬 PPT | 3 | `ppt2pdf` / `ppt2img` / `merge4ppt` | -| 🛠️ Tools | 10 | `transtools` / `qrcodetools` / `passwordtools` | -| 🎥 Video | 4 | `video2mp3` / `audio2txt` / `txt2mp3` | -| 💬 WeChat | 7 | `send_message` / `chat_robot` / `receive_message` | -| 📄 Word | 5 | `docx2pdf` / `merge4docx` / `docx4imgs` | -| 🏷️ Ruiming | 3 | `screen_unmarked_image` / `change_label_in_xml` | - -👉 Full index: [`skills/README.md`](./skills/README.md) - ---- - -## 📦 Installation - -```bash -# Install everything (recommended) -pip install -i https://mirrors.aliyun.com/pypi/simple/ python-office -U - -# Install only what you need (lighter) -pip install popdf # PDF processing only -pip install poimage # Image processing only -pip install poword # Word processing only -pip install poexcel # Excel processing only -``` - -> Python version: **Python 3.7+** - ---- - -## 🚀 5-line Quick Start - -```python -# 1. PDF → Word -from skills.pdf import pdf2docx -pdf2docx(input_file='report.pdf', output_file='report.docx') - -# 2. Compress an image -from skills.image import compress_image -compress_image(input_file='big.jpg', output_file='small.jpg', quality=30) - -# 3. Add a watermark to an image -from skills.image import add_watermark -add_watermark(file='photo.jpg', mark='@python-office') - -# 4. Generate a word cloud -from skills.image import txt2wordcloud -txt2wordcloud(filename='article.txt', result_file='wordcloud.png') - -# 5. Generate a QR code -from skills.tools import qrcodetools -qrcodetools(url='https://www.python-office.com', output='qrcode.png') -``` - ---- - -## 🛠️ Components - -Each feature is accessible via the traditional `import office` style, or directly from `skills.xxx`. - -| Module | Description | Skills Path | -|--------|-------------|-------------| -| PyOfficeRobot | WeChat bot | `skills/wechat/` | -| poocr | OCR (invoice, table, image) | `skills/ocr/` | -| popdf | PDF → Word / image / split / merge / encrypt | `skills/pdf/` | -| poemail | Auto-send emails | `office/api/email.py` | -| porobot | AI bot | `office/api/tools.py` | -| poimage | Image compress / watermark / word cloud / filters | `skills/image/` | -| poai | AI utilities | `office/lib/` | -| poexcel | Excel merge / split / mock data | `skills/excel/` | -| poword | Word → PDF / extract images | `skills/word/` | -| pofile | Batch file rename / organize | `skills/file/` | -| search4file | Document search | `skills/file/` | -| poppt | PPT → PDF / image | `skills/ppt/` | -| wftools | Translation / QR code / password generator, etc. | `skills/tools/` | -| pofinance | Stock T+0 calculator | `skills/finance/` | -| pohan | Chinese programming | - | -| povideo | Video → audio / speech recognition | `skills/video/` | -| potime | Time utilities | - | -| poprogress | Progress bar utilities | - | -| pocode | Code management | - | - ---- - -## 💡 Featured Skills - -
-📊 Excel Processing (click to expand) - -```python -from skills.excel import fake2excel -fake2excel(columns=['name', 'phone'], rows=1000, path='test.xlsx') - -from skills.excel import merge2excel -merge2excel(dir_path='./my_excels', output_file='all.xlsx') -``` -
- -
-📕 PDF Processing (click to expand) - -```python -from skills.pdf import pdf2docx # PDF → Word -from skills.pdf import pdf2imgs # PDF → images -from skills.pdf import merge2pdf # Merge multiple PDFs -from skills.pdf import split4pdf # Split a PDF -from skills.pdf import encrypt4pdf # Encrypt a PDF -from skills.pdf import add_watermark_by_parameters # PDF watermark -``` -
- -
-🖼️ Image Processing (click to expand) - -```python -from skills.image import compress_image # Compress images -from skills.image import add_watermark # Add watermark -from skills.image import del_watermark # Remove watermark -from skills.image import txt2wordcloud # Generate word cloud -from skills.image import pencil4img # Pencil-sketch style -from skills.image import img2Cartoon # Cartoon style -from skills.image import decode_qrcode # Decode QR code -``` -
- -
-💬 WeChat Bot (click to expand) - -```python -from skills.wechat import send_message -send_message(who='File Transfer', message='Hello!') - -from skills.wechat import send_message_by_time -send_message_by_time(who='File Transfer', message='Good morning', time='08:00:00') -``` -
- -
-🎬 Video Processing (click to expand) - -```python -from skills.video import video2mp3 # Video → MP3 -from skills.video import audio2txt # Audio → text -from skills.video import txt2mp3 # Text → speech -from skills.video import mark2video # Video watermark -``` -
- ---- - -## 📝 Documentation - -- 📘 [Chinese Documentation](https://github.com/CoderWanFeng/python-office/tree/develop/.qoder/repowiki/zh/content) -- 📗 [English Documentation](https://github.com/CoderWanFeng/python-office/tree/develop/.qoder/repowiki/en/content) -- 🎬 [Video Tutorials](https://www.python-office.com/video/video.html) -- 🤖 [Skills Index](./skills/README.md) - ---- - -## 🤝 Contributing - -Contributions are welcome. Please submit your PR in a dedicated folder: - -- Create a folder with your GitHub username under [contributors](./contributors/) -- Put all your code inside that folder -- **Do not modify any other folders** -- For questions about existing code, please open an issue - -### Code Style - -1. **Comments**: Document every parameter and return value of new functions -2. **Formatting**: Format only your own code -3. **Tests**: Unit tests are optional but strongly recommended -4. **Skills**: When adding a new method, also add a Skill wrapper under `skills///` - ---- - -## 🐞 Bug Reports & Suggestions - -Please only submit issues related to the python-office codebase itself. We don't answer general Python learning questions. - -- [GitHub Issues](https://github.com/CoderWanFeng/python-office/issues) -- [Gitee Issues](https://gitee.com/CoderWanFeng/python-office/issues) -- [AtomGit Issues](https://atomgit.com/CoderWanFeng1/python-office/issues) - ---- - -## ⭐ Star History - -[![Stargazers over time](https://starchart.cc/CoderWanFeng/python-office.svg)](https://starchart.cc/CoderWanFeng/python-office) - ---- - -## 📌 Contact the Author - -

- - - -

- -

- 👉 Join the open-source community · - WeChat the author 👈 -

- ---- - -

- If this project helps you, a ⭐ Star is the best encouragement! -

diff --git a/README.md b/README.md index f4f2815..aeab920 100644 --- a/README.md +++ b/README.md @@ -1,168 +1,191 @@ +

+ 中文 · + 中文文档 · + English +

+

- - python-office - + + python-office +

+

python-office

+

- 👉 项目官网 · - 交流群 · - 中文文档 · - 视频教程 👈 + 🚀 Office automation, one line of code at a time +
+ 73 ready-to-use Skills covering PDF, Word, Excel, PPT, Email, WeChat, Images, Video and more

- - GitHub stars - - - Gitee stars - - - PyPI Downloads - - - Python Version - - - AI交流群 - + + PyPI + Total Downloads + + GitHub stars + Gitee stars + + Python + Windows + + WeChat

--- -## 📚 简介 +## ⚡ TL;DR -**python-office** 是一个专注于**办公自动化**的 Python 第三方库。 -每个功能只需 **一行代码** 即可完成,让你不学 Python 也能自动化办公。 +> **python-office** is the most popular Python office-automation library in the Chinese-speaking world. +> One library covers 90% of office scenarios: **PDF / Word / Excel / PPT conversion, image processing, video & audio, WeChat bot, email, file management, OCR, AI tools**... +> Zero Python knowledge required — **every feature is one line of code**. -> ✨ 功能持续更新中,欢迎提交你的功能需求 → [开发者微信](https://www.python4office.cn/wechat-qrcode/) +```python +pip install python-office +``` + +```python +import office # one import, all features available +``` + +--- -### 🍺 为什么选择 python-office? +## ✨ Key Features -| 特点 | 说明 | -|------|------| -| 🚀 **一行代码** | 90% 的功能只需要一行代码,零基础也能用 | -| 🎯 **场景驱动** | 覆盖 PDF、Word、Excel、PPT、邮件、微信、图片、视频等真实办公场景 | -| 🧩 **Skills 体系** | 内置 73 个开箱即用的 Skill,每个 Skill 独立可调用 | -| 🤖 **AI 友好** | 完整 `SKILL.md` + YAML 描述,可被 Codex / Claude / Cursor 等 AI 直接识别 | -| 🛠️ **可拆可合** | 按需 `pip install popdf / poimage / poword ...`,不冗余 | -| 💬 **中文友好** | 全中文文档、视频教程、微信答疑群 | +| | Feature | +|---|---| +| 🎯 **One-line code** | 90% of features need only `office.module.method()` — zero learning curve | +| 🧩 **73 Skills** | Every feature independently importable, install only what you need | +| 🤖 **AI-friendly** | Each Skill ships `SKILL.md` + YAML, recognizable by Codex / Claude / Cursor | +| 🌏 **Beginner-friendly** | Full tutorials, video guides, and an active WeChat community | +| 🪶 **Lightweight** | `pip install popdf / poimage / poword` for sub-libraries — no bloat | +| 🔄 **Continuously updated** | Maintained since 2020, 73+ features still evolving | +| 📦 **One import** | `import office` brings everything; or import individually | +| 🛡️ **Stable** | Used by thousands of projects, MIT licensed | --- -## ✨ Skills 体系(73 个开箱即用) +## 📸 Demo -`python-office` 内置了一套 **Skill 体系**:把库里的 73 个方法封装成 73 个独立可调用的 Skill, -每个 Skill 有自己的 `SKILL.md` 文档,可以单独 import,也可以整体使用。 +> 🚧 **Showcase area** — replace these with your own screenshots or GIFs -```bash -# 方式 1:直接调用具体 Skill +| Image Processing | PDF Processing | WeChat Bot | +|:---:|:---:|:---:| +| Watermark / Word cloud / Sketch | Convert / Merge / Encrypt | Broadcast / Smart chat | +| ![demo-image](https://placehold.co/280x180/4A90E2/fff?text=Image+Skills) | ![demo-pdf](https://placehold.co/280x180/50C878/fff?text=PDF+Skills) | ![demo-wechat](https://placehold.co/280x180/E74C3C/fff?text=WeChat+Skills) | + +| Excel Processing | PPT Processing | Video / Audio | +|:---:|:---:|:---:| +| Mock data / Merge / Split | Convert / Snapshot | Extract audio / Subtitle | +| ![demo-excel](https://placehold.co/280x180/F39C12/fff?text=Excel+Skills) | ![demo-ppt](https://placehold.co/280x180/9B59B6/fff?text=PPT+Skills) | ![demo-video](https://placehold.co/280x180/1ABC9C/fff?text=Video+Skills) | + +--- + +## 🧭 Quick Navigation + +| What do you want to do? | Jump to | +|------------------------|---------| +| First time here | [📦 Installation](#-installation) | +| See 5 examples | [🚀 Quick Start](#-quick-start) | +| Find a specific feature | [🛠️ Components](#%EF%B8%8F-components) or [`skills/README.md`](./skills/README.md) | +| Understand the Skills system | [✨ Skills system](#-skills-system-73-ready-to-use-skills) | +| Ask the community | [💬 Contact](#-contact-the-author) | +| Contribute code | [🤝 Contributing](#-contributing) | + +--- + +## 🧩 Skills system (73 ready-to-use Skills) + +`python-office` ships with a built-in **Skill system**: the library's 73 methods are wrapped as 73 independently importable Skills, each with its own `SKILL.md` documentation. + +> 💡 **Why Skills?** Skills let Codex, Claude, Cursor and other AI tools **automatically recognize** your request and call the right function. + +```python +# Option 1: Import a specific Skill from skills.image import compress_image compress_image(input_file='photo.jpg', output_file='photo_small.jpg', quality=30) -# 方式 2:按分类批量导入 +# Option 2: Import by category from skills.pdf import pdf2docx pdf2docx(input_file='report.pdf', output_file='report.docx') + +# Option 3: Original office style (still works) +import office +office.image.compress_image(input_file='photo.jpg', output_file='photo_small.jpg', quality=30) ``` -### 📋 13 个分类速查表 +### 📋 13 Categories at a Glance -| 分类 | Skill 数量 | 典型 Skill | -|------|----------|-----------| +| Category | Skills | Typical Skills | +|----------|--------|----------------| | 📊 Excel | 7 | `fake2excel` / `merge2excel` / `excel2pdf` | | 📁 File | 9 | `replace4filename` / `get_files` | -| 💰 Finance | 1 | `t0`(股票做 T 收益计算)| +| 💰 Finance | 1 | `t0` (stock T+0 return calculator) | | 🖼️ Image | 9 | `compress_image` / `add_watermark` / `txt2wordcloud` | | 📝 Markdown | 1 | `excel2markdown` | -| 🔍 OCR | 1 | `VatInvoiceOCR2Excel`(增值税发票识别)| +| 🔍 OCR | 1 | `VatInvoiceOCR2Excel` (VAT invoice recognition) | | 📕 PDF | 13 | `pdf2docx` / `pdf2imgs` / `merge2pdf` / `encrypt4pdf` | | 🎬 PPT | 3 | `ppt2pdf` / `ppt2img` / `merge4ppt` | | 🛠️ Tools | 10 | `transtools` / `qrcodetools` / `passwordtools` | | 🎥 Video | 4 | `video2mp3` / `audio2txt` / `txt2mp3` | | 💬 WeChat | 7 | `send_message` / `chat_robot` / `receive_message` | | 📄 Word | 5 | `docx2pdf` / `merge4docx` / `docx4imgs` | -| �️ Ruiming | 3 | `screen_unmarked_image` / `change_label_in_xml` | +| 🏷️ Ruiming | 3 | `screen_unmarked_image` / `change_label_in_xml` | -👉 查看完整 Skill 索引:[`skills/README.md`](./skills/README.md) +👉 Full index: [`skills/README.md`](./skills/README.md) --- -## 📦 安装 +## 📦 Installation ```bash -# 一键安装(推荐) +# Install everything (recommended) pip install -i https://mirrors.aliyun.com/pypi/simple/ python-office -U -# 按需安装子库(更轻量) -pip install popdf # 只用 PDF 处理 -pip install poimage # 只用图片处理 -pip install poword # 只用 Word 处理 -pip install poexcel # 只用 Excel 处理 +# Install only what you need (lighter) +pip install popdf # PDF processing only +pip install poimage # Image processing only +pip install poword # Word processing only +pip install poexcel # Excel processing only ``` -> Python 版本要求:**Python 3.7+** +> **Python version**: Python 3.7+ +> **Install issues?** [📝 Troubleshooting](https://www.python4office.cn/python-office/profile/) --- -## � 5 行代码快速体验 +## 🚀 Quick Start ```python -# 1. PDF 转 Word +# 1. PDF → Word from skills.pdf import pdf2docx pdf2docx(input_file='report.pdf', output_file='report.docx') -# 2. 批量压缩图片 +# 2. Compress an image from skills.image import compress_image compress_image(input_file='big.jpg', output_file='small.jpg', quality=30) -# 3. 给图片加水印 +# 3. Add a watermark to an image from skills.image import add_watermark add_watermark(file='photo.jpg', mark='@python-office') -# 4. 文本生成词云 +# 4. Generate a word cloud from skills.image import txt2wordcloud txt2wordcloud(filename='article.txt', result_file='wordcloud.png') -# 5. 生成二维码 +# 5. Generate a QR code from skills.tools import qrcodetools qrcodetools(url='https://www.python-office.com', output='qrcode.png') ``` ---- - -## 🛠️ 功能分类 - -每个功能既支持传统的 `import office` 方式,也支持从 `skills.xxx` 单独调用。 - -| 模块 | 功能 | Skills 路径 | -|------|------|-------------| -| PyOfficeRobot | 微信机器人 | `skills/wechat/` | -| poocr | 文字识别(发票、表格、图片)| `skills/ocr/` | -| popdf | PDF 转 Word / 图片 / 拆分 / 合并 / 加密 | `skills/pdf/` | -| poemail | 自动发邮件 | `office/api/email.py` | -| porobot | AI 机器人 | `office/api/tools.py` | -| poimage | 图片压缩 / 水印 / 词云 / 滤镜 | `skills/image/` | -| poai | AI 工具集 | `office/lib/` | -| poexcel | Excel 合并 / 拆分 / 模拟数据 | `skills/excel/` | -| poword | Word 转 PDF / 提取图片 | `skills/word/` | -| pofile | 文件批量重命名 / 整理 | `skills/file/` | -| search4file | 文档搜索 | `skills/file/` | -| poppt | PPT 转 PDF / 图片 | `skills/ppt/` | -| wftools | 翻译 / 二维码 / 密码生成等小工具 | `skills/tools/` | -| pofinance | 股票做 T 计算 | `skills/finance/` | -| pohan | 中文编程 | - | -| povideo | 视频转音频 / 语音识别 | `skills/video/` | -| potime | 时间工具 | - | -| poprogress | 进度条工具 | - | -| pocode | 代码管理 | - | +> 🎬 Video tutorials: --- -## 💡 精选 Skill 一览 +## 💡 Featured Skills
-📊 Excel 处理(点击展开) +📊 Excel Processing (click to expand) ```python from skills.excel import fake2excel @@ -174,91 +197,198 @@ merge2excel(dir_path='./my_excels', output_file='all.xlsx')
-📕 PDF 处理(点击展开) +📕 PDF Processing (click to expand) ```python from skills.pdf import pdf2docx # PDF → Word -from skills.pdf import pdf2imgs # PDF → 图片 -from skills.pdf import merge2pdf # 合并多个 PDF -from skills.pdf import split4pdf # 拆分 PDF -from skills.pdf import encrypt4pdf # 加密 PDF -from skills.pdf import add_watermark_by_parameters # PDF 加水印 +from skills.pdf import pdf2imgs # PDF → images +from skills.pdf import merge2pdf # Merge multiple PDFs +from skills.pdf import split4pdf # Split a PDF +from skills.pdf import encrypt4pdf # Encrypt a PDF +from skills.pdf import add_watermark_by_parameters # PDF watermark ```
-🖼️ Image 图像处理(点击展开) +🖼️ Image Processing (click to expand) ```python -from skills.image import compress_image # 压缩图片 -from skills.image import add_watermark # 加水印 -from skills.image import del_watermark # 去水印 -from skills.image import txt2wordcloud # 生成词云 -from skills.image import pencil4img # 转铅笔画 -from skills.image import img2Cartoon # 转卡通风格 -from skills.image import decode_qrcode # 解析二维码 +from skills.image import compress_image # Compress images +from skills.image import add_watermark # Add watermark +from skills.image import del_watermark # Remove watermark +from skills.image import txt2wordcloud # Generate word cloud +from skills.image import pencil4img # Pencil-sketch style +from skills.image import img2Cartoon # Cartoon style +from skills.image import decode_qrcode # Decode QR code ```
-💬 微信机器人(点击展开) +💬 WeChat Bot (click to expand) ```python from skills.wechat import send_message -send_message(who='文件传输助手', message='Hello!') +send_message(who='File Transfer', message='Hello!') from skills.wechat import send_message_by_time -send_message_by_time(who='文件传输助手', message='早安', time='08:00:00') +send_message_by_time(who='File Transfer', message='Good morning', time='08:00:00') ```
-🎬 Video 视频处理(点击展开) +🎬 Video Processing (click to expand) ```python -from skills.video import video2mp3 # 视频 → MP3 -from skills.video import audio2txt # 音频 → 文字 -from skills.video import txt2mp3 # 文字 → 语音 -from skills.video import mark2video # 视频加文字水印 +from skills.video import video2mp3 # Video → MP3 +from skills.video import audio2txt # Audio → text +from skills.video import txt2mp3 # Text → speech +from skills.video import mark2video # Video watermark ```
--- -## 📝 文档 +## 🌟 Use Cases -- � [中文文档](https://github.com/CoderWanFeng/python-office/tree/develop/.qoder/repowiki/zh/content) -- 📗 [English Document](https://github.com/CoderWanFeng/python-office/tree/develop/.qoder/repowiki/en/content) -- 🎬 [视频教程](https://www.python-office.com/video/video.html) -- 🤖 [Skills 索引](./skills/README.md) +python-office fits the following roles and scenarios: + +| 👤 Role | 🎯 Scenario | +|--------|-------------| +| 📊 **Office workers** | Batch process PDF, Excel, Word, PPT — 10x efficiency | +| 🎓 **Students / Teachers** | Paper formatting, test grading, resource organization | +| 👨‍💻 **Developers** | Automation scripts, crawler data processing, batch files | +| 🤖 **AI enthusiasts** | Let AI auto-call tools for complex office tasks | +| 📷 **Content creators** | Batch image processing, video-to-audio, QR generation | +| 💼 **Finance / HR** | Invoice OCR, Excel merging, file organization | --- -## 🤝 贡献代码 +## 🛠️ Components + +Each feature is accessible via the traditional `import office` style, or directly from `skills.xxx`. + +| Module | Description | Skills Path | +|--------|-------------|-------------| +| PyOfficeRobot | WeChat bot | `skills/wechat/` | +| poocr | OCR (invoice, table, image) | `skills/ocr/` | +| popdf | PDF → Word / image / split / merge / encrypt | `skills/pdf/` | +| poemail | Auto-send emails | `office/api/email.py` | +| porobot | AI bot | `office/api/tools.py` | +| poimage | Image compress / watermark / word cloud / filters | `skills/image/` | +| poai | AI utilities | `office/lib/` | +| poexcel | Excel merge / split / mock data | `skills/excel/` | +| poword | Word → PDF / extract images | `skills/word/` | +| pofile | Batch file rename / organize | `skills/file/` | +| search4file | Document search | `skills/file/` | +| poppt | PPT → PDF / image | `skills/ppt/` | +| wftools | Translation / QR code / password generator, etc. | `skills/tools/` | +| pofinance | Stock T+0 calculator | `skills/finance/` | +| pohan | Chinese programming | - | +| povideo | Video → audio / speech recognition | `skills/video/` | +| potime | Time utilities | - | +| poprogress | Progress bar utilities | - | +| pocode | Code management | - | -python-office 欢迎任何人来添砖加瓦。建议提交的 PR 放在一个独立的文件夹下: +--- -- 在 [contributors](./contributors/) 文件夹中,用自己的 GitHub 名字建一个文件夹; -- 把自己的所有代码,都提交到这个自己的文件夹里; -- **不要修改其它任何文件夹下的代码**; -- 对现有代码有疑问,可以直接提 issue。 +## 🗺️ Roadmap -### 代码风格 +- [x] **v1.x**: 73 Skills covering all office automation scenarios +- [x] **Skills system**: Every feature independently AI-callable +- [ ] **v2.0**: Plugin architecture with custom Skill support +- [ ] **Web GUI**: Visual operation interface +- [ ] **More AI capabilities**: AI writing, AI data analysis +- [ ] **Enterprise edition**: Private deployment + permission management -1. **注释**:请为每个新函数的参数、返回值添加说明 -2. **格式**:只能格式化自己写的代码 -3. **测试**:单元测试可选,但强烈推荐 -4. **Skill**:新增方法时,建议同时在 `skills/<分类>/<方法名>/` 下加 Skill 封装 +Feel free to submit requests in [Issues](https://github.com/CoderWanFeng/python-office/issues)! --- -## 🐞 提供 Bug 反馈或建议 +## 📝 Documentation + +- 📘 [Chinese Documentation](https://www.python4office.cn/python-office/profile/) +- 📗 [English Documentation](https://www.python4office.cn/python-office/profile/) +- 🎬 [Video Tutorials](https://www.python-office.com/video/video.html) +- 🤖 [Skills Index](./skills/README.md) +- ❓ [FAQ](https://www.python4office.cn/python-office/profile/) + +--- + +## 🤝 Contributing + +Contributions are welcome. Please submit your PR in a dedicated folder: + +- Create a folder with your GitHub username under [contributors](./contributors/) +- Put all your code inside that folder +- **Do not modify any other folders** +- For questions about existing code, please open an issue + +### Code Style + +1. **Comments**: Document every parameter and return value of new functions +2. **Formatting**: Format only your own code +3. **Tests**: Unit tests are optional but strongly recommended +4. **Skills**: When adding a new method, also add a Skill wrapper under `skills///` + +### Contributors ✨ + +Thanks to everyone who makes python-office better! + + + + + +--- + +## 🐞 Bug Reports & Suggestions + +Please only submit issues related to the python-office codebase itself. We don't answer general Python learning questions. + +- [GitHub Issues](https://github.com/CoderWanFeng/python-office/issues) +- [Gitee Issues](https://gitee.com/CoderWanFeng/python-office/issues) +- [AtomGit Issues](https://atomgit.com/CoderWanFeng1/python-office/issues) + +--- + +## 💖 Sponsor + +If python-office has saved you significant time, please consider supporting continued development: + +- ⭐ **Star this repo** — the biggest support +- 🗣️ **Tell your friends** — word of mouth +- 💰 **WeChat tip** — see the QR code at the bottom of this README +- 🐛 **Contribute code** — submit a PR or Issue + +--- + +## 📜 License + +This project is licensed under the [MIT License](https://opensource.org/licenses/MIT). + +``` +MIT License + +Copyright (c) 2026 CoderWanFeng + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +``` + +--- -提交问题反馈时,请务必填写和 python-office 代码本身有关的问题,不进行 Python 学习或个人练习的答疑。 +## 🙏 Acknowledgments -- [GitHub Issue](https://github.com/CoderWanFeng/python-office/issues) -- [Gitee Issue](https://gitee.com/CoderWanFeng/python-office/issues) -- [AtomGit Issue](https://atomgit.com/CoderWanFeng1/python-office/issues) +- Thanks to all contributors and issue reporters +- Thanks to the [python4office](https://www.python4office.cn/) community +- Inspired by outstanding open-source projects like [Requests](https://github.com/psf/requests), [FastAPI](https://github.com/tiangolo/fastapi), [LangChain](https://github.com/langchain-ai/langchain) +- Built with ❤️ in China --- @@ -268,7 +398,7 @@ python-office 欢迎任何人来添砖加瓦。建议提交的 PR 放在一个 --- -## 📌 联系作者 +## 📌 Contact the Author

@@ -277,12 +407,12 @@ python-office 欢迎任何人来添砖加瓦。建议提交的 PR 放在一个

- 👉 加入开源交流群 · - 联系作者微信 👈 + 👉 Join the open-source community · + WeChat the author 👈

---

- 如果这个项目对你有帮助,欢迎 ⭐ Star 支持一下! + If this project helps you, a ⭐ Star is the best encouragement!