[BUG] Cannot set property 'marked' of undefined
cooperbrown9 opened this issue Β· comments
π Bug Report
This error can be found at this path
exceljs/lib/xlsx/xform/sheet/data-validations-xform.js:75:42
It happens whenever I try to create a sheet. However, it doesn't seem too important because simply wrapping a try/catch around it fixes the problem. Literally, just wrapping it in try/catch works. But what gives? Has anyone else gotten this behavior?
```
try {
// originally, there is no try catch, just the line below
//
dvMap[otherAddress].marked = true;
} catch(e) {
console.log('cant set undefined marked blah blah', e)
}
@cooperbrown9 I used the code from the master branch and didn't find the problem. Can you conveniently provide a version of the library and an example that can reproduce this problem? This will help us a lot in solving the problem.
I'm running into the same error. It looks like it is caused when you read an excel file and then write it back out. Though, it only happens when the cells are configured a certain way. I couldn't isolate the exact issue. I've included the code and an excel file to hopefully help you reproduce it. I'm running exceljs version 3.8.2 from npm in chrome version 80.0.3987.149.
async load() {
try {
const wb = new ExcelJS.Workbook()
await wb.xlsx.load(await this.file.arrayBuffer())
const out = await wb.xlsx.writeBuffer() // This is the line that causes the error.
this.download(out)
} catch (e) {
console.error(e)
}
}
SimbaUploadPage.vue?915c:70 TypeError: Cannot set property 'marked' of undefined
at eval (exceljs.min.js?e8ae:3)
at Array.map (<anonymous>)
at eval (exceljs.min.js?e8ae:3)
at t.value (exceljs.min.js?e8ae:3)
at t.value (exceljs.min.js?e8ae:3)
at eval (exceljs.min.js?e8ae:3)
at Array.forEach (<anonymous>)
at eval (exceljs.min.js?e8ae:3)
at u (exceljs.min.js?e8ae:17)
at Generator.eval [as _invoke] (exceljs.min.js?e8ae:17)
I studied the source code and the corresponding xml file. The error caused by different values of sqref
attribute.
<dataValidation type="textLength" operator="greaterThan" showInputMessage="1" showErrorMessage="1" sqref="E1 E4">
<formula1>2</formula1>
</dataValidation>