Loading...
Loading...
Compare original and translation side by side
.docx.docx.docx.docx| Task | Tool/Library | Language | When to Use |
|---|---|---|---|
| Create DOCX | python-docx | Python | Reports, contracts, proposals |
| Create DOCX | docx | Node.js | Server-side document generation |
| Convert to HTML | mammoth.js | Node.js | Web display, content extraction |
| Parse DOCX | python-docx | Python | Extract text, tables, metadata |
| Template fill | docxtpl | Python | Mail merge, template-based generation |
| Review workflow | Word compare, comments/highlights | Any | Human review without OOXML surgery |
| Tracked changes | OOXML inspection, docx4j/OpenXML SDK/Aspose | Any | True redlines or parsing tracked changes |
| 任务 | 工具/库 | 语言 | 适用场景 |
|---|---|---|---|
| 创建DOCX文件 | python-docx | Python | 报告、合同、提案 |
| 创建DOCX文件 | docx | Node.js | 服务端文档生成 |
| 转换为HTML | mammoth.js | Node.js | Web展示、内容提取 |
| 解析DOCX文件 | python-docx | Python | 提取文本、表格、元数据 |
| 模板填充 | docxtpl | Python | 邮件合并、基于模板的生成 |
| 审阅工作流 | Word对比、批注/高亮 | 任意 | 无需操作OOXML的人工审阅 |
| 修订记录 | OOXML检查、docx4j/OpenXML SDK/Aspose | 任意 | 真正的修订标记或解析修订记录 |
docxtplpython-docxdocxmammothdocxtplpython-docxdocxmammoth.doc.docxpython-docx.doc.docxpython-docxfrom docx import Document
from docx.shared import Inches, Pt
from docx.enum.text import WD_ALIGN_PARAGRAPH
doc = Document()from docx import Document
from docx.shared import Inches, Pt
from docx.enum.text import WD_ALIGN_PARAGRAPH
doc = Document()undefinedundefinedimport { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell } from 'docx';
import * as fs from 'fs';
const doc = new Document({
sections: [{
properties: {},
children: [
new Paragraph({
children: [
new TextRun({ text: 'Bold text', bold: true }),
new TextRun({ text: ' and normal text.' }),
],
}),
new Table({
rows: [
new TableRow({
children: [
new TableCell({ children: [new Paragraph('Cell 1')] }),
new TableCell({ children: [new Paragraph('Cell 2')] }),
],
}),
],
}),
],
}],
});
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync('output.docx', buffer);
});import { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell } from 'docx';
import * as fs from 'fs';
const doc = new Document({
sections: [{
properties: {},
children: [
new Paragraph({
children: [
new TextRun({ text: 'Bold text', bold: true }),
new TextRun({ text: ' and normal text.' }),
],
}),
new Table({
rows: [
new TableRow({
children: [
new TableCell({ children: [new Paragraph('Cell 1')] }),
new TableCell({ children: [new Paragraph('Cell 2')] }),
],
}),
],
}),
],
}],
});
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync('output.docx', buffer);
});from docxtpl import DocxTemplate
doc = DocxTemplate('template.docx')
context = {
'company_name': 'Acme Corp',
'date': '2025-01-15',
'items': [
{'name': 'Widget A', 'price': 100},
{'name': 'Widget B', 'price': 200},
]
}
doc.render(context)
doc.save('filled_template.docx')from docxtpl import DocxTemplate
doc = DocxTemplate('template.docx')
context = {
'company_name': 'Acme Corp',
'date': '2025-01-15',
'items': [
{'name': 'Widget A', 'price': 100},
{'name': 'Widget B', 'price': 200},
]
}
doc.render(context)
doc.save('filled_template.docx')from docx import Document
doc = Document('input.docx')from docx import Document
doc = Document('input.docx')undefinedundefined| Element | Python Method | Node.js Class |
|---|---|---|
| Heading 1 | | |
| Bold | | |
| Italic | | |
| Font size | | |
| Alignment | | |
| Page break | | |
| 元素 | Python方法 | Node.js类 |
|---|---|---|
| 一级标题 | | |
| 粗体 | | |
| 斜体 | | |
| 字体大小 | | |
| 对齐方式 | | |
| 分页符 | | |
assets/doc-template-pack.mdassets/doc-template-pack.mdscripts/docx_inspect_ooxml.pyscripts/docx_extract.pypython-docxscripts/docx_render_template.pydocxtpldocxtplscripts/docx_to_html.mjs.docxmammothscripts/docx_inspect_ooxml.pyscripts/docx_extract.pypython-docxscripts/docx_render_template.pydocxtpldocxtplscripts/docx_to_html.mjs.docxmammoth