签出这个专案
而这里是一个伟大的快速入门指南
使用起来非常简单,我还没有测试过,但是应该可以使用:
from docx import documentdocument = document()r = 2 # Number of rows you wantc = 2 # Number of collumns you wanttable = document.add_table(rows=r, cols=c)table.style = 'LightShading-Accent1' # set your style, look at the help documentation for more helpfor y in range(r): for x in range(c): cell.text = 'text goes here'document.save('demo.docx') # Save document
它不认为您可以使用该库设置页面方向属性,但是您可以做的是创建一个空白的Word文档,该文档自己处于横向状态,将其存储在工作目录中,并在每次生成此文档时对其进行复制文件。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)