[BUG] Styles from cellStyleXfs are not preserved
- Dominant language
- JavaScript
- Stars
- 15.5k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
## 🐛 Bug Report
Cells with a cell style that has a xfId attribute are actually getting their styles from the cellStyleXfs section of the `styles.xml`. Right now ExcelJs does not preserve the styles from that section, so saving a file that uses them, will result in styles getting lost.
## Steps To Reproduce
Open a xlsx file that uses cellStyleXfs styles (for example cell fills) and save it with ExcelJs. The saved file will not have these cell styles.
## The expected behaviour:
The saved file should look the same as the original file.
## Possible solution (optional, but very helpful):
The original styles in cellStyleXfs should be preserved. `xfId` attributes of cellXfs should also be preserved. Ideally it should be possible to change or delete these in code.
https://github.com/exceljs/exceljs/blob/5bed18b45e824f409b08456b59b87430ded023ab/lib/xlsx/xform/style/styles-xform.js#L151
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading lib/xlsx/xform/style/styles-xform.js around line 151 and inspect how styles.xml cellStyleXfs and cellXfs are handled. Reproduce the issue with an XLSX file using cellStyleXfs, such as a cell fill, then verify that saving with ExcelJS preserves the appearance and xfId attributes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100