整行的条件格式

Conditional formatting to entire row

我在 C# 中使用 EPPLUS 为 Excel 编写了一个代码,如果单元格的值超过 100,它会将单元格填充为绿色。它有效:

ExcelAddress _formatRangeAddress = new ExcelAddress("G4:G" + (c.Count + 4));    
string _statement = "IF(G4>100,1,0)";
var _cond2 = hoja.ConditionalFormatting.AddExpression(_formatRangeAddress);
_cond2.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
_cond2.Style.Fill.BackgroundColor.Color = System.Drawing.Color.LimeGreen;
_cond2.Formula = _statement;

但我真正需要的是填满整行。如果我改变范围:

ExcelAddress _formatRangeAddress = new ExcelAddress("A4:G" + (c.Count + 4));  

仅适用于 A 列中的单元格,不适用于整行。

我做错了什么?

G4 进行绝对引用,否则公式将应用于该单元格。所以改变这一行:

string _statement = "IF(G4>100,1,0)";

仅基于 G4

应用于整行
string _statement = "IF($G>100,1,0)";

(回复评论)

应用于相对于行号的整行,但保持列固定为 G:

string _statement = "IF($G4>100,1,0)";