Skip to content

Some formula one @ are added #512

@fabioebner

Description

@fabioebner

I trying to genereate one xlsx file. with a fomrula in a cell a basic formula

=IF(I2="";"";CONCAT(I2;LEFT(T2;1)))

but when I open the excel the formula was changed to

=@if(I2="";"";CONCAT(I2;LEFT(T2;1)))

and the cell dont show anything until I manually remove the @

Image

this is my code:

ws.formula(dataRowIndex,coluna.getXlsxColumnOrder(),xmlEscape(formula));

and the xmlEscape method

    public static String xmlEscape(String input) {
        if (input == null) {
            return null;
        }

        // A ordem de substituição é importante para evitar substituições duplas
        // Primeiro substituímos '&', para não "bagunçar" as substituições dos outros caracteres.
        String escaped = input.replace("&", "&");

        // Agora substituímos os demais.
        escaped = escaped.replace("<", "&lt;");
        escaped = escaped.replace(">", "&gt;");
        escaped = escaped.replace("\"", "&quot;");
        escaped = escaped.replace("'", "&apos;");

        return escaped;
    }

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