exceljs / exceljs/exceljs

[BUG] Excel shows error when reading generated file

Open
#2,184 20 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15.5k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug Report

Excel does not open the file generated by exceljs. When opening, it shows the error below

![image](https://user-images.githubusercontent.com/528366/209547935-d02cf325-86f5-4b83-b72c-eee8dd52e03c.png)

Error log (the meaningful part of it):
```
Removed Records: AutoFilter from /xl/tables/table1.xml part (Table)
```

Lib version: 4.3.0

## Steps To Reproduce

Use an Excel file that has a **Table** and **AutoFilter** enabled for that table, and run the following code:

![image](https://user-images.githubusercontent.com/528366/209548246-afff1b85-90e1-48d4-b938-baa8babca736.png)

```javascript
let workBook = new ExcelJS.Workbook()
await workBook.xlsx.readFile("./x.xlsx");
await workBook.xlsx.writeFile("./y.xlsx");
```

When opening "y.xlsx" the above error occurs.

## The expected behaviour:

The file is opened without any issues.

## Possible solution (optional, but very helpful):

Please see the **linked PR** that fixes the problem.

The issue is caused by invalid combination written into excel file. Original file is on the left, saved is on the right:
![image](https://user-images.githubusercontent.com/528366/209548633-1227630b-0b7d-4dff-815d-35cd8ee2e169.png)

The problem is library reaction on "undefined" (missing) value in the source file.
It uses wrong default ("1") instead of missing value. Another thing is it turns "0" into "1" for the header, but that does not block opening.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.