【发布时间】:2021-04-29 00:03:55
【问题描述】:
我想使用 python 在 docx 文件中写入/包含两个以上的表。 如何使用 python 将此结构写为 docx 文件中的表?
我为单个表尝试了以下代码。现在我想在一个 docx 中创建 2 个表。
table = document.add_table(rows=rows_no,cols=1)
Timeline = row[5]
print (row[0],row[3],"Timing:",row[5])
cells = table.add_row().cells
cells[0].paragraphs[0].add_run( Compliance_requirements).bold = True
cells[0].paragraphs[1].add_run( "Obs: "+Finding_Description).text = True
cells[0].paragraphs[2].add_run( "requitements: "+requirements).text = True
cells[0].paragraphs[3].add_run( "Timeline: Need"+Timeline+" days of notice period .").text = True
document.add_paragraph()
【问题讨论】:
标签: python python-3.x python-docx