如何正确缩进python-docx?

weixin_38093996 2019-09-12 03:29:19

缩进似乎非常简单,终端打印正确的缩进,但相同的缩进不会反映在我保存的Word docx中。我在这里做错了什么? from docx import Document from docx.shared import Inches worddoc = Document() paragraph = worddoc.add_paragraph('Left Indent Test') paragraph.left_indent = Inches(.25) print(paragraph.left_indent.inches) worddoc.save('left_indent.docx')






...全文
499 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38102527 2019-09-12
  • 打赏
  • 举报
回复

原来是文档错误。 如果使用新的API工作原理: paragraph.paragraph_format.left_indent = Inches(0.25) 的left_indent财产被转移到paragraph_format“子对象”几个版本早在ParagraphFormat类用于由Paragraph和ParagraphStyle对象都。 如果您将在GitHub上的python-docx问题跟踪器中提交错误报告,我们将在下次我们访问该文档时获取更新的文档。

472

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧