700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > python docx table 边框_使用pythondocx指定表中的边框外观

python docx table 边框_使用pythondocx指定表中的边框外观

时间:2021-05-18 10:36:09

相关推荐

python docx table 边框_使用pythondocx指定表中的边框外观

我正在浏览python-docx的教程和文档。在

但是,我找不到任何关于如何指定和操作在microsoftword文档中创建的表的边框外观的参考。在

当我使用以下代码时:from docx import Document

from docx.shared import Inches

document = Document()

################################

################################

################################

table = document.add_table(rows=1, cols=3)

hdr_cells = table.rows[0].cells

hdr_cells[0].text = 'Qty'

hdr_cells[1].text = 'Id'

hdr_cells[2].text = 'Desc'

row_cells = table.add_row().cells

row_cells[0].text = 'Str0'

row_cells[1].text = 'Str1'

row_cells[2].text = 'Str2'

row2_cells = table.add_row().cells

row2_cells[0].text = 'Str00'

row2_cells[1].text = 'Str11'

row2_cells[2].text = 'Str22'

################################

################################

################################

document.save('demo.docx')

生成的docx文件显示了带有标题的3x3表。目前此表上没有黑色边框(内部或外部)。在

如何指定页眉周围的上下边框、环绕表格的下边框以及内部垂直边框?在

例如:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。