[英]How can I set row height in a table to be fixed in 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
, docx.enum.table
此錯誤:
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'
檢查源,那里有table.py文件,但其中只有WD_TABLE_ALIGNMENT
和WD_TABLE_DIRECTION
。
我的python-docx版本是0.8.6
您引用的鏈接實際上是將來的功能(即尚未實現)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.