Doc Xls2docx Xlsx
/install doc-xls2docx-xlsx
\r \r
doc_xls2docx_xlsx\r
\r
技能说明 / Skill Description\r
\r
概述 / Overview\r
\r This skill converts legacy Microsoft Office files to modern formats:\r
- .doc → .docx using Word COM automation (Windows only, requires Word)\r
- .xls → .xlsx using Python (xlrd + openpyxl, cross-platform)\r \r 本技能用于将旧版 Microsoft Office 文件转换为现代格式:\r
- .doc → .docx:使用 Word COM 自动化(仅 Windows,需要安装 Word)\r
- .xls → .xlsx:使用 Python 库(xlrd + openpyxl,跨平台)\r \r ---\r \r
前置依赖 / Prerequisites\r
\r
.doc → .docx 转换需要 / For .doc Conversion\r
\r Windows 系统 + Microsoft Word 已安装\r \r 使用 pywin32 通过 Word COM 接口进行转换,无需 LibreOffice。\r \r Requires Windows OS and Microsoft Word installed. Uses pywin32 Word COM interface.\r \r
.xls → .xlsx 转换需要 / For .xls Conversion\r
\r Python 包依赖 / Python Dependencies:\r \r
pip install xlrd openpyxl\r
```\r
\r
---\r
\r
## 使用方法 / Usage\r
\r
### 1. 转换单个文件 / Convert Single File\r
\r
#### .doc → .docx\r
\r
```powershell\r
python \x3Cskill_dir>/scripts/doc_to_docx_com.py input.doc [output.docx]\r
```\r
\r
#### .xls → .xlsx\r
\r
```powershell\r
python \x3Cskill_dir>/scripts/xls_to_xlsx.py input.xls [output.xlsx]\r
```\r
\r
### 2. 批量转换目录 / Batch Convert Directory\r
\r
#### .doc → .docx\r
\r
```powershell\r
python \x3Cskill_dir>/scripts/doc_to_docx_com.py "C:\path o\directory"\r
```\r
\r
#### .xls → .xlsx\r
\r
```powershell\r
python \x3Cskill_dir>/scripts/xls_to_xlsx.py --batch "C:\path o\directory"\r
```\r
\r
---\r
\r
## 转换脚本说明 / Conversion Scripts\r
\r
### doc_to_docx_com.py\r
\r
- **平台**: Windows only (requires Word COM)\r
- **功能**: 将 .doc 文件转换为 .docx 格式\r
- **特点**: 保留原文档格式、样式、图片等所有内容\r
- **原理**: 使用 pywin32 调用 Word COM 接口,以只读方式打开并另存为 .docx\r
\r
### xls_to_xlsx.py\r
\r
- **平台**: Cross-platform (Windows/macOS/Linux)\r
- **功能**: 将 .xls 文件转换为 .xlsx 格式\r
- **特点**: 支持多 Sheet、日期格式、字体样式、单元格对齐等\r
- **原理**: 使用 xlrd 读取 .xls,使用 openpyxl 创建 .xlsx\r
\r
---\r
\r
## 示例 / Examples\r
\r
### 示例 1: 批量转换当前目录所有旧格式文件\r
\r
**Example 1: Batch convert all legacy files in current directory**\r
\r
```powershell\r
# 转换所有 .doc 文件\r
python doc_to_docx_com.py "C:\Users\Documents"\r
\r
# 转换所有 .xls 文件\r
python xls_to_xlsx.py --batch "C:\Users\Documents"\r
```\r
\r
### 示例 2: 转换单个文件并指定输出位置\r
\r
**Example 2: Convert single file with output path**\r
\r
```powershell\r
# .doc 转换\r
python doc_to_docx_com.py "input.doc" "output.docx"\r
\r
# .xls 转换\r
python xls_to_xlsx.py "input.xls" "output.xlsx"\r
```\r
\r
---\r
\r
## 注意事项 / Important Notes\r
\r
1. **文件覆盖**: 如果输出文件已存在,会被自动覆盖\r
2. **临时文件**: Word COM 转换会在同一目录生成临时文件,转换完成后自动清理\r
3. **大文件**: 超大 .xls 文件(>10MB)可能转换较慢\r
4. **编码问题**: 某些特殊字符可能出现编码问题,脚本已做处理\r
\r
1. **File Overwrite**: Existing output files will be overwritten\r
2. **Temp Files**: Word COM creates temp files in same directory, auto-cleaned after conversion\r
3. **Large Files**: Very large .xls files (>10MB) may convert slowly\r
4. **Encoding**: Special characters are handled by the scripts\r
\r
---\r
\r
## 错误处理 / Error Handling\r
\r
| 错误类型 | 解决方法 |\r
|----------|----------|\r
| "pywin32 not found" | 运行: `pip install pywin32` |\r
| "Word COM failed" | 确保 Word 已安装且可正常打开 |\r
| "xlrd import error" | 运行: `pip install xlrd openpyxl` |\r
| "Permission denied" | 关闭正在使用的源文件 |\r
\r
| Error | Solution |\r
|--------|----------|\r
| "pywin32 not found" | Run: `pip install pywin32` |\r
| "Word COM failed" | Ensure Word is installed and can open files |\r
| "xlrd import error" | Run: `pip install xlrd openpyxl` |\r
| "Permission denied" | Close the source file if it's open |\r
\r
---\r
\r
## 脚本执行流程 / Script Execution Flow\r
\r
### doc_to_docx_com.py 流程\r
\r
1. 初始化 Python COM\r
2. 创建 Word Application 对象(不可见)\r
3. 以只读方式打开 .doc 文件\r
4. 另存为 .docx 格式 (FileFormat=16)\r
5. 关闭文档,退出 Word\r
6. 输出转换结果\r
\r
### xls_to_xlsx.py 流程\r
\r
1. 使用 xlrd 打开 .xls 文件\r
2. 创建新的 openpyxl 工作簿\r
3. 遍历每个 Sheet,复制数据\r
4. 处理日期、布尔值、错误类型等特殊格式\r
5. 保存为 .xlsx 文件\r
6. 输出转换结果\r
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install doc-xls2docx-xlsx - After installation, invoke the skill by name or use
/doc-xls2docx-xlsx - Provide required inputs per the skill's parameter spec and get structured output
What is Doc Xls2docx Xlsx?
Skill for batch converting legacy Office files (.doc, .xls) to modern formats (.docx, .xlsx). Use when user asks to convert .doc/.xls files, migrate Office d... It is an AI Agent Skill for Claude Code / OpenClaw, with 106 downloads so far.
How do I install Doc Xls2docx Xlsx?
Run "/install doc-xls2docx-xlsx" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Doc Xls2docx Xlsx free?
Yes, Doc Xls2docx Xlsx is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Doc Xls2docx Xlsx support?
Doc Xls2docx Xlsx is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Doc Xls2docx Xlsx?
It is built and maintained by juanfenglong (@longjf25); the current version is v1.0.0.