Python 您能否根据openpyxl中的条件调整行高?

Python 您能否根据openpyxl中的条件调整行高?,python,excel,pandas,formatting,openpyxl,Python,Excel,Pandas,Formatting,Openpyxl,我有一个现有条件,如果列的值低于1000,则用颜色填充任何行。 我想同样的行高度也要调整 Index Name Amount 1 Tom 1000 2 3 Mary 2000 4 Sean 3000 red\u background=PatternFill(开始\u color='FF140000',结束\u color='FF140000',填充\u type=“solid”) 差异样式=差异样式(填充=红色背景) 规则=规

我有一个现有条件,如果列的值低于1000,则用颜色填充任何行。 我想同样的行高度也要调整

Index  Name     Amount
1      Tom      1000
2
3      Mary     2000
4      Sean     3000

red\u background=PatternFill(开始\u color='FF140000',结束\u color='FF140000',填充\u type=“solid”)
差异样式=差异样式(填充=红色背景)
规则=规则(type=“expression”,dxf=diff\u样式)

rule.formula=[“$c1如果不使用条件格式,则必须手动调整行对象的高度:例如
ws.row\u维度[5]。高度=4
red_background = PatternFill(start_color='FF140000', end_color='FF140000', fill_type = "solid") 
diff_style = DifferentialStyle(fill=red_background)
rule = Rule(type="expression", dxf=diff_style)
rule.formula = ["$C1<1000"]
worksheet.conditional_formatting.add("A1:W1000", rule)