Align your Paragraph via Python-docx

本文介绍如何使用docx.enum.text中的WD_PARAGRAPH_ALIGNMENT进行段落对齐,包括左对齐、右对齐、两端对齐及分散对齐等操作。同时提醒在设置段落时要注意使用add_paragraph()来区分不同段落,避免因 导致的段落合并问题。

When you try to align your paragraph with the

WD_PARAGRAPH_ALIGNMENT

from docx.enum.text, you may like to set the

yourparagraph.alignment

as

WD_PARAGRAPH_ALIGNMENT.JUSTIFY

or *.LEFT, *.RIGHT, or even *.DISTRIBUTED.

Be careful to separate your run with a new paragraph as

yourdocument.add_paragraph().

Otherwise, the document will take the run you are setting as in the SAME paragraph even if separated with the `enter's as

'\n'.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值