pdfmake icon indicating copy to clipboard operation
pdfmake copied to clipboard

colspan gives the 'Uncaught TypeError: Cannot read property '0' of undefined' error

Open mpsbhat opened this issue 11 years ago • 1 comments

I have created a plugin to download table as pdf using pdfMake but colspan gives the 'Uncaught TypeError: Cannot read property '0' of undefined' error.

The table is as follows:

var dd = { 'pageSize': 'A3', 'pageOrientation': 'landscape', 'content': [ { 'style': 'tableExample', 'table': { 'headerRows': 1, 'dontBreakRows': true, 'body': [ [ { 'text': 'Col1', 'style': 'tableHeader', 'colSpan': 1, 'rowSpan': 1 }, { 'text': 'Col2', 'style': 'tableHeader', 'colSpan': 1, 'rowSpan': 1 }, { 'text': 'Col3', 'style': 'tableHeader', 'colSpan': 1, 'rowSpan': 1 }, { 'text': 'Col4', 'style': 'tableHeader', 'colSpan': 1, 'rowSpan': 1 }, { 'text': 'Col5', 'style': 'tableHeader', 'colSpan': 1, 'rowSpan': 1 }, { 'text': 'Col6', 'style': 'tableHeader', 'colSpan': 1, 'rowSpan': 1 } ], [ { 'text': 'Total', 'style': '', 'colSpan': 3, 'rowSpan': 1 }, { 'text': '', 'style': '', 'colSpan': 1, 'rowSpan': 1 }, { 'text': '', 'style': '', 'colSpan': 1, 'rowSpan': 1 }, { 'text': '574', 'style': '', 'colSpan': 1, 'rowSpan': 1 }, { 'text': '92', 'style': '', 'colSpan': 1, 'rowSpan': 1 }, { 'text': '482', 'style': '', 'colSpan': 1, 'rowSpan': 1 } ] ] } } ], 'styles': { 'header': { 'fontSize': 11, 'bold': true, 'margin': [ 0, 0, 0, 10 ] }, 'subheader': { 'fontSize': 16, 'bold': true, 'margin': [ 0, 10, 0, 5 ] }, 'tableExample': { 'width': '100%' }, 'tableHeader': { 'bold': true, 'fontSize': 13, 'color': 'black' } }, 'defaultStyle': {} }

mpsbhat avatar Dec 27 '14 07:12 mpsbhat

Tested, it works in the new version.

liborm85 avatar Dec 23 '16 08:12 liborm85