我在openpyxl中使用条件格式,但是在排除空白单元格时遇到了麻烦。我有一个列,其中的数字是用CellisRule格式化的。我使用的代码如下。在
ws2.conditional_formatting.add('C3:C25',CellIsRule(operator='lessThan', formula=['85'], stopIfTrue=True, fill=redFill,font=whiteText))
ws2.conditional_formatting.add('C3:C25',CellIsRule(operator='greaterThan', formula=['89.99'], stopIfTrue=True, fill=greenFill))
ws2.conditional_formatting.add('C3:C25',CellIsRule(operator='between', formula=['85', '89.99'], stopIfTrue=True, fill=yellowFill))
我试图使用公式化规则,但不知道该如何使用。在
更新:
与其使用条件格式,不如使用for循环。在
^{pr2}$
如果使用公式,则应使用an
expression
类型规则。一般来说,最好是分别编写规则和样式:相关问题 更多 >
编程相关推荐