Closed
Description
🐛 Bug Report
Lib version: 3.9.0
Steps To Reproduce
const Excel = require("exceljs");
const fs = require("fs");
const inputFilePath = "input.xlsx";
const outputFilePath = "output.xlsx";
(async () => {
const workbook = new Excel.Workbook();
const data = await fs.promises.readFile(inputFilePath);
await workbook.xlsx.load(data.buffer);
// Write.
await fs.promises.writeFile(outputFilePath, await workbook.xlsx.writeBuffer());
})().catch((e) => console.error(e));
Opening the output file with Excel results in the following:
<? version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<logFileName>
error043120_01.xml
</logFileName>
<summary>
Errors were detected in file 'C:\Users\Rob\Documents\glen-tmp\output.xlsx'
</summary>
<removedParts summary="Following is a list of removed parts:">
<removedPart>
Removed Part: /xl/styles.xml part with XML error. (Styles) Load error. Line 2, column 6585.
</removedPart>
</removedParts>
<repairedRecords summary="Following is a list of repairs:">
<repairedRecord>
Repaired Records: Cell information from /xl/worksheets/sheet2.xml part
</repairedRecord>
<repairedRecord>
Repaired Records: Column information from /xl/worksheets/sheet2.xml part
</repairedRecord>
<repairedRecord>
Repaired Records: Conditional formatting from /xl/worksheets/sheet2.xml part
</repairedRecord>
</repairedRecords>
</recoveryLog>
Just opening and saving the file causes the file size to go from 33 KB to 14 KB. 😮
If I clear the conditional formatting in the input file, then I don't see the errors (although the file size still drops dramatically, which is a bit worrying).
The expected behaviour:
No errors when opening the file in Excel, and possibly more similar file size of input and output files.
Possible solution (optional, but very helpful):
n/a
Edit: Here's a smaller reproduction:
Metadata
Metadata
Assignees
Labels
No labels