EPPLUS 中带通配符的条件格式
Conditional Formatting with wildcards in EPPLUS
我正在尝试将格式应用于包含 "SUBTOTAL " 字的单元格,这是我的代码:
ExcelAddress _formatRangeAddress = new ExcelAddress(2,1,tam,40);
string _statement = "$A2=\"SUBTOTAL \"";
var _cond1 = hoja.ConditionalFormatting.AddExpression(_formatRangeAddress);
_cond1.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
_cond1.Style.Fill.BackgroundColor.Color = System.Drawing.Color.LightSalmon;
_cond1.Style.Font.Color.Color = System.Drawing.Color.White;
_cond1.Formula = _statement;
如果单元格仅包含此单词,则工作正常,但在所有情况下(除了 1)单元格的值将为 "SUBTOTAL " + 更多文本。
所以我想知道是否可以使用通配符或类似于 SQL like
语句的东西。
谢谢。
=ISNUMBER(FIND("SUBTOTAL ", $A2))
如果区分大小写
=ISNUMBER(SEARCH("SUBTOTAL ", $A2))
如果不区分大小写。
Search 和 Find 函数 returns #VALUE! 的搜索词首次出现的索引(如果未找到)。 IsNumber 决定,如果它是数字或#VALUE!
我正在尝试将格式应用于包含 "SUBTOTAL " 字的单元格,这是我的代码:
ExcelAddress _formatRangeAddress = new ExcelAddress(2,1,tam,40);
string _statement = "$A2=\"SUBTOTAL \"";
var _cond1 = hoja.ConditionalFormatting.AddExpression(_formatRangeAddress);
_cond1.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
_cond1.Style.Fill.BackgroundColor.Color = System.Drawing.Color.LightSalmon;
_cond1.Style.Font.Color.Color = System.Drawing.Color.White;
_cond1.Formula = _statement;
如果单元格仅包含此单词,则工作正常,但在所有情况下(除了 1)单元格的值将为 "SUBTOTAL " + 更多文本。
所以我想知道是否可以使用通配符或类似于 SQL like
语句的东西。
谢谢。
=ISNUMBER(FIND("SUBTOTAL ", $A2))
如果区分大小写
=ISNUMBER(SEARCH("SUBTOTAL ", $A2))
如果不区分大小写。
Search 和 Find 函数 returns #VALUE! 的搜索词首次出现的索引(如果未找到)。 IsNumber 决定,如果它是数字或#VALUE!