我已经以编程方式制作了一张excel表。现在我想在特定的单元格范围上添加条件格式。
格式化类型是values greater than 0 (>0)
如何去做?
在excel中,我可以使用Cell Values Greater Than
的内置公式来完成它。但是如何使用C#和epplus将它嵌入excel?
答案 0 :(得分:9)
我找不到这个问题的确切解决方案。所以添加我自己的解决方案
var cellAddress = new ExcelAddress(
<startingRow>,
<startingcolumn>,
<endingRow>,
<endingColumn>);
var cf = ws.ConditionalFormatting.AddGreaterThan(cellAddress);
cf.Formula = "0";
cf.Style.Fill.BackgroundColor.Color = Color.LightGreen;