Exceljs: TypeError : Excel file that contains charts

Created on 23 Jun 2017  路  4Comments  路  Source: exceljs/exceljs

Hi,

I have this error Type Error: Cannot read property 'rId' of null when 脿 try to use an Excel file that contains charts. If I remove charts no error.

Is it possible to fix this?

Thanks for your response.

Most helpful comment

also getting this error, no charts though.

Uncaught (in promise) TypeError: Cannot read property 'rId' of null
two-cell-anchor-xform.js:109 
 at module.exports.reconcile /exceljs/dist/es5/xlsx/xform/drawing/two-cell-anchor-xform.js:111:41

code causing it..

var workbook = new Excel.Workbook();
        workbook.xlsx.readFile(form_path)
            .then(function() {
                var worksheet = workbook.getWorksheet(1);
                var row = worksheet.getRow(5);
                row.getCell(1).value = 5; // A5's value set to 5
                row.commit();
                return workbook.xlsx.writeFile('new.xlsx');
            })

confirmed that form_path is returning correct path to .xlsx file.

UPDATE:

found the code cauing it. it also causes it for images.

Changed (/exceljs/dist/es5/xlsx/xform/drawing/two-cell-anchor-xform.js:)
Line 111 and 112 into:

if(model.picture != null){
    var rel = options.rels[model.picture.rId];
    var match = rel.Target.match(/.*\/media\/(.+[.][a-z]{3,4})/);
}

All 4 comments

also getting this error, no charts though.

Uncaught (in promise) TypeError: Cannot read property 'rId' of null
two-cell-anchor-xform.js:109 
 at module.exports.reconcile /exceljs/dist/es5/xlsx/xform/drawing/two-cell-anchor-xform.js:111:41

code causing it..

var workbook = new Excel.Workbook();
        workbook.xlsx.readFile(form_path)
            .then(function() {
                var worksheet = workbook.getWorksheet(1);
                var row = worksheet.getRow(5);
                row.getCell(1).value = 5; // A5's value set to 5
                row.commit();
                return workbook.xlsx.writeFile('new.xlsx');
            })

confirmed that form_path is returning correct path to .xlsx file.

UPDATE:

found the code cauing it. it also causes it for images.

Changed (/exceljs/dist/es5/xlsx/xform/drawing/two-cell-anchor-xform.js:)
Line 111 and 112 into:

if(model.picture != null){
    var rel = options.rels[model.picture.rId];
    var match = rel.Target.match(/.*\/media\/(.+[.][a-z]{3,4})/);
}

Is this patched to some release?

Also getting this error after adding a chart to a worksheet.

This was fixed in 0.6.0 (dfd12e80f24d922a20007243619e2f4850dcaa13)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CountryGuide picture CountryGuide  路  3Comments

timcullen picture timcullen  路  3Comments

kurt343 picture kurt343  路  3Comments

jtraband picture jtraband  路  3Comments

TranBaVinhSon picture TranBaVinhSon  路  4Comments