在python-docx中,当我们添加如下文档标题时,它会自动在标题下方添加一条水平线。这似乎是一个边界。你知道如何删除它吗?谢谢你。
main_title = self.document.add_heading(self.doc_title, 0)
这个解决方案对我有用:
title = doc.add_heading('My Heading', 0)
title_style = title.style
title_style.paragraph_format._element.xpath('.//w:pBdr')[0].getparent().remove(
title_style.paragraph_format._element.xpath('.//w:pBdr')[0])