条件格式给出属性:' noneType'对象没有属性'组'

发布于 2025-01-24 11:29:40 字数 367 浏览 1 评论 0原文

我正在尝试使用XLSWRITER在Excel中的一列中运行条件格式。我想以某种格式将列中的空白行。在下面,我附上了代码段。但这给了我一个属性:“ nontype”对象没有属性“ group”。

format1 = workbook.add_format({'bg_color': '#FFC7CE',
                               'font_color': '#9C0006'})

worksheet.conditional_format('G:H', {'type': 'no_blanks','format':format1})

谁能帮我吗?

I am trying to run a conditional format for one of my column in excel using xlswriter. I want to have the blank rows in the column in a certain format. Below I have attached the code snippet. But it is giving me an AttributeError:'NoneType' object has no attribute 'group'.

format1 = workbook.add_format({'bg_color': '#FFC7CE',
                               'font_color': '#9C0006'})

worksheet.conditional_format('G:H', {'type': 'no_blanks','format':format1})

Can anyone help me on this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

末蓝 2025-01-31 11:29:40

在这种情况下,不支持“ g:h”列。您需要指定完整范围,例如:

worksheet.conditional_format('G1:H1048576',
                             {'type': 'no_blanks','format':format1})

或使用行柱符号:

worksheet.conditional_format(0, 5, 1048575, 6,
                             {'type': 'no_blanks','format':format1})

The column notation 'G:H' isn't supported in this case. You will need to specify the full range like:

worksheet.conditional_format('G1:H1048576',
                             {'type': 'no_blanks','format':format1})

Or with row-column notation:

worksheet.conditional_format(0, 5, 1048575, 6,
                             {'type': 'no_blanks','format':format1})
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文