Skip to content

Commit

Permalink
[FIX] xlsx export: empty string in filtered range
Browse files Browse the repository at this point in the history
When we try to export a sheet that have a data filter, and that in the
filtered zone there is a formula evaluating to an empty string, Excel
will say that it found an issue when opening the xlsx.

That's because in the xlsx we have to put all the values that are not
filtered, except for empty values. This was correctly handled for simple
empty cells, but not for cells evaluating to an empty string.

Odoo task 3231699

closes #2235

X-original-commit: 3cff999
Signed-off-by: Minne Adrien (adrm) <[email protected]>
Signed-off-by: Rémi Rahir (rar) <[email protected]>
  • Loading branch information
hokolomopo committed Mar 16, 2023
1 parent c74b1d1 commit 656936f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/xlsx_export.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,14 @@ describe("Test XLSX export", () => {
expect(exported.sheets[0].filterTables[0].filters[0].filteredValues).toEqual([]);
});

test("Formulas evaluated to empty string are not added to filteredValues", () => {
const model = new Model();
createFilter(model, "A1:B4");
setCellContent(model, "A2", '=""');
const exported = getExportedExcelData(model);
expect(exported.sheets[0].filterTables[0].filters[0].filteredValues).toEqual([]);
});

test("Export data filters snapshot", async () => {
const model = new Model();
setCellContent(model, "A1", "Hello");
Expand Down

0 comments on commit 656936f

Please sign in to comment.