Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Corrupted file if negativeBorderColor and negativeFillColor are defined together #2547

Open
darkag opened this issue Oct 3, 2023 · 0 comments

Comments

@darkag
Copy link

darkag commented Oct 3, 2023

馃悰 Bug Report

Excel can't open file when negativeBorderColor and negativeFillColor are used together in conditional formatting rule

Steps To Reproduce

add conditionnal formatting with negativeBorderColor and negativeFillColor

worksheet.addConditionalFormatting({
    ref: "A1:A10"
    rules: [
        {
            type: "dataBar",
            cfvo: [{ type: "min" }, { type: "max" }],
            color: { argb: "FF50FF50" },
            negativeFillColor: { argb: 'FFFF5050' },
            border: true,
            negativeBarBorderColorSameAsPositive: false,
            borderColor: { argb: "FF50FF50" },
            negativeBorderColor: { argb: 'FFFF5050' },
            axisColor: { auto: "1"},
        }
    ]
});

The expected behaviour:

Excel should be able to open the file ^^

Possible solution (optional, but very helpful):

invert the following lines in exceljs/lib/xlsx/xform/sheet/cf-ext/databar-ext-xform.js

      this.negativeBorderColorXform.render(xmlStream, model.negativeBorderColor);   
      this.negativeFillColorXform.render(xmlStream, model.negativeFillColor);

it seems that negativeFillColor must appear before negativeBorderColor (at least with excel 2021)

darkag added a commit to darkag/exceljs that referenced this issue Jan 5, 2024
invert order of negativeFillColor and negativeBorderColor
darkag added a commit to darkag/exceljs that referenced this issue Feb 23, 2024
invert order of negativeFillColor and negativeBorderColor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant