Skip to content

ConditionalFormattingExpressionRule expression should be escaped #563

@yannlefoll125

Description

@yannlefoll125

Used version: 0.16.4

I tried to apply a ConditionalFormattingExpressionRule on a range, using the Excel formula:

ws.range(0,0,10,10).style().fillColor(Color.LIGHT_LAUREL_GREEN)
                  .set(new ConditionalFormattingExpressionRule(
                      "MOD(SUMPRODUCT(($A$3:$A3<>$A$2:$A2)+($B$3:$B3<>$B$2:$B2)),2)=0", true
                  ));

But it didnt apply the style. It didn't work until I changed to:

ws.range(0,0,10,10).style().fillColor(Color.LIGHT_LAUREL_GREEN)
                  .set(new ConditionalFormattingExpressionRule(new XmlEscapeHelper().escape("MOD(SUMPRODUCT(($A$3:$A3<>$A$2:$A2)+($B$3:$B3<>$B$2:$B2)),2)=0"), true)));

I think it would be better if the escape would be applied by default in the ConditionalFormattingExpressionRule class, as the use of the library should now have to care about the inner workings of Excel to apply a formula as it is inside Excel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions