Conditional formatting formulas with fixed column using $


#1

I’m trying to set a conditional formatting rule based on a cell with a fixed column but dynamic row (i.e. $B16) but I’m getting this exception: “Exception in thread “main” com.aspose.cells.CellsException: Invalid name: $B16”

This is the code snippet where I’m setting the formula

Style euro = pvtsheet.getCells().get(“G1”).getStyle();
euro.setCustom(“£#,##0;[Red]-£#,##0”);
currency.setFormula1("=IF(FIND(“SPS”,$B16)>0,1,0)", true, false);

Does aspose cells not support the use of the $ to fix the column in a formula?


#2

For some reason it works when you use the addCondition method for FormatConditionCollection so my problem is fixed, but can this behavior be explained?


#3

@wtchang,

Thank you for your query.

Please send us the complete sample code (both with and without issue) that can be compiled and executed here. We will re-produce this issue and provide assistance about it.


#4

Just tested again and it’s working. I might have been doing something weird earlier, but both methods seem to work!


#5

@wtchang,

Thank you for the feedback.