我有一个简单的脚本来使用pythondocx生成文档.我可以很好地生成文档,但当我try 更改与文档部分相关的任何内容时,我得到错误:
错误-处理时出错:‘TWIPS’对象不可调用
from docx import Document
from docx.shared import Inches
from docx.section import Section
doc = Document()
section = doc.sections[0]
section.page_width(Inches(5))
section.page_height(Inches(5))
我已经try 了不同的单元和调用section数组的方法.我假设创建的文档默认已经有一个节,但是我也try 在它之前调用doc.add_section(),同样的问题发生了.