创建和更新 Microsoft Word .docx 文件。
项目描述
python-docx-whtsky
python-docx-whtsky是一个 Python 库,用于创建和更新 Microsoft Word (.docx) 文件。
更多信息可在python-docx 文档中找到
发布历史
0.8.10.3 (2019-11-11)
- TableCell 的
add_table方法firstCol, firstRow, lastCol, lastRow, hBand, vBand)现在接受。
0.8.10.2 (2019-10-23)
- 添加重新启动列表编号的功能。( https://github.com/python-openxml/python-docx/pull/210 )
例子
https://github.com/python-openxml/python-docx/issues/25#issuecomment-143231954
from docx import Document
document = Document()
# Add desired numbering styles to your template file.
# Extract abstractNumId from there. In this example, abstractNumId is 10
numId = document.get_new_list("10")
# Add a list
p = document.add_paragraph(style = 'ListParagraph', text = "a")
p.num_id = numId
p.level = 0
p = document.add_paragraph(style = 'ListParagraph', text = "b")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "c")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "d")
p.num_id = numId
p.level = 0
p = document.add_paragraph(style = 'ListParagraph', text = "e")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "f")
p.num_id = numId
p.level = 0
# Restart numbering at the outer level
numId = document.get_new_list("10")
# Add the same list once again. The numbering is restarted
p = document.add_paragraph(style = 'ListParagraph', text = "a")
p.num_id = numId
p.level = 0
p = document.add_paragraph(style = 'ListParagraph', text = "b")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "c")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "d")
p.num_id = numId
p.level = 0
p = document.add_paragraph(style = 'ListParagraph', text = "e")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "f")
p.num_id = numId
p.level = 0
document.save("num.docx")
0.8.10.1 (2019-10-16)
- 允许表格查看(标题行/列,页脚行/列,带)修改。https://github.com/python-openxml/python-docx/pull/579
- 为段落添加了字体属性。https://github.com/python-openxml/python-docx/pull/417
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
python-docx-whtsky-0.8.10.3.tar.gz
(5.5 MB
查看哈希)
内置分布
关
python_docx_whtsky -0.8.10.3-py2.py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | a487a25ea6f3d66816d8c5cbb54659f773eeea019d34c126c6cb6ee0db856456 |
|
| MD5 | feb89e63692d7315f5711ed84d34336a |
|
| 布莱克2-256 | 5279ebaaaad26bc2c8bbc7a955b462c7f125caf88a00453cd09be41c8669a647 |