【问题标题】:How can I shade heading in word document created using Python-docx?如何在使用 Python-docx 创建的 word 文档中遮蔽标题?
【发布时间】:2021-07-07 08:26:24
【问题描述】:

我想使用 python-docx 包创建一个 word 文档。由于我有很多指标,我想给标题加上阴影以便分隔段落,如图所示:

为此,MS-Word 有一个名为“Shaded”的内置主题。

我已经尝试过document.add_heading("Heading1"),但我没有相关选项可以在 Python 中为标题添加阴影。是否可以使用 Python 中的任何属性或属性对标题进行着色?

【问题讨论】:

    标签: python python-3.x docx python-docx heading


    【解决方案1】:

    Word 中有这样一种东西,例如“为段落或段落样式添加阴影”,它具有您提到的为段落赋予“背景颜色”的效果。

    不幸的是,python-docx 目前没有 API 支持。

    【讨论】:

    • 感谢您的回复。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-17
    • 1970-01-01
    • 2021-01-02
    相关资源
    最近更新 更多