Open
Description
My code worked fine with exceljs up to v. 0.2.4 but doesn't work with recent exceljs versions (0.2.6 and above) with following error:
Unhandled rejection TypeError: Cannot read property '0' of null
at Object.module.exports.decodeAddress (D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\exceljs\lib\utils\col-cache.js:111:36)
at Object.module.exports.decodeEx (D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\exceljs\lib\utils\col-cache.js:179:21)
at Object.CellMatrix.addCell (D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\exceljs\lib\utils\cell-matrix.js:36:29)
at D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\exceljs\lib\doc\defined-names.js:176:16
at Array.forEach (native)
at Function._.each._.forEach (D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\underscore\underscore.js:78:11)
at D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\exceljs\lib\doc\defined-names.js:175:9
at Array.forEach (native)
at Function._.each._.forEach (D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\underscore\underscore.js:78:11)
at Object.model (D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\exceljs\lib\doc\defined-names.js:173:7)
at Object.model (D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\exceljs\lib\doc\workbook.js:146:30)
at D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\exceljs\lib\xlsx\xlsx.js:579:31
at tryCatcher (D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\bluebird\js\release\promise.js:504:31)
at Promise._settlePromise (D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\bluebird\js\release\promise.js:561:18)
at Promise._settlePromiseCtx (D:\PROJECTS\DPHKH\src\node-dphkh\node_modules\bluebird\js\release\promise.js:598:10)
Line 111 of col-cache.js is part of decodeAddress
function:
var col = value.match(/[A-Z]+/)[0];
Basically, what happens here, is that decodeEx
function for some reason gets 'Some Text'!$1:$1
as a parameter, then splits it two times to get "$1"
string and then sends it to the decodeAddress
. In that function it gets evaluated against regexp and that search returns null
because there is no uppercase letters in the "$1"
string. And then it takes first item from null
, which obviously throws an exception.
I hope that my explanation is clear and it will help to solve this issue.
Btw, thank you for the library, it helps a lot.