【发布时间】:2022-01-02 13:45:36
【问题描述】:
我不知道为什么这段代码会更改某些单元格的设置,但不会更改某些单元格的设置。特别是,某些单元格上没有应用“돋움”字体
可能是什么原因?
这是更改单元格设置的代码部分(?)。 i代表行,3代表列
cell(0, 3) 和 cell(4, 3) 不变,但 cell(1~3, 3) 变化。
for i, j in enumerate([0,1,1,2,5]):
~~~
des.tables[table_number].cell(i, 3).paragraphs[0].paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER
des.tables[table_number].cell(i, 3).paragraphs[0].runs[0].font.size = Pt(8)
des.tables[table_number].cell(i, 3).paragraphs[0].runs[0].font.name = "돋움"
des.tables[table_number].cell(i, 3).paragraphs[0].paragraph_format.space_before = 0
des.tables[table_number].cell(i, 3).paragraphs[0].paragraph_format.line_spacing = 0.75
des.tables[table_number].cell(i, 3).paragraphs[0].paragraph_format.space_after = 0
【问题讨论】:
标签: python word python-docx word-table