1
我想从文档中使用此示例将行高设置为固定值。如何在python-docx中修复表格中的行高?
(如果链路断开内容)
>>> from docx.enum.table import WD_ROW_HEIGHT
>>> row = table.add_row()
>>> row
<docx.table._Row object at 0x...>
>>> row.height_rule
None
>>> row.height_rule = WD_ROW_HEIGHT.EXACTLY
>>> row.height
None
>>> row.height = Pt(24)
但是,我不能从docx.enum.table
给这个错误导入WD_ROW_HEIGHT
:
Traceback (most recent call last):
File "C:/Users/Calderdale NUT/Google Drive/CDFU/Membership Python/labels test.py", line 2, in <module>
from docx.enum.table import WD_ROW_HEIGHT
ImportError: cannot import name 'WD_ROW_HEIGHT'
检查源,表.py文件存在,但只有WD_TABLE_ALIGNMENT
和WD_TABLE_DIRECTION
英寸。
我的python-docx版本是0.8.6
这完美地回答了我的问题。如果有任何想法,它会*实施,这将是有益的,但我意识到可能没有。 –