Pdfmake: colSpan in first row causes error or display problems

Created on 11 Jul 2016  路  3Comments  路  Source: bpampuch/pdfmake

This definition causes error:

{ content:[
{
table:{
widths:['auto','auto'],
body:[
[ {text:'header', colSpan:2} ],
['abc','def']
]
}
}
]}

but, moving the first row with colSpan to second row, displays correctly;
{ content:[
{
table:{
widths:['auto','auto'],
body:[
['abc','def'],
[ {text:'header', colSpan:2} ]
]
}
}
]}

table

Most helpful comment

I ran into a similar issue, I believe you need an empty element in your first example try this instead

{ 
  content:[
    {
      table:{
        widths:['auto','auto'],
        body:[
          [ {text:'header', colSpan:2}, {text:''} ], //note the second object with empty string for 'text'
          ['abc','def']
        ]
      }
    }
  ]
}

All 3 comments

I ran into a similar issue, I believe you need an empty element in your first example try this instead

{ 
  content:[
    {
      table:{
        widths:['auto','auto'],
        body:[
          [ {text:'header', colSpan:2}, {text:''} ], //note the second object with empty string for 'text'
          ['abc','def']
        ]
      }
    }
  ]
}

They must be defined all cells of table. This is a feature (probably poor, but it is so.).

I just wasted 2 hours of my time into this issue!!! Please refer back to this issue in the Playground so people don't lose their minds over this weird behaviour.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmatesic picture dmatesic  路  3Comments

jkd003 picture jkd003  路  3Comments

sayjeyhi picture sayjeyhi  路  3Comments

stefanmihoc picture stefanmihoc  路  3Comments

ValeSauer picture ValeSauer  路  3Comments